Studies have shown that spaceflight affects the emotional and social performance of astronauts. Identifying the neural mechanisms underlying the emotional and social effects of spacefaring-specific environments is essential to specify targeted treatment and prevention interventions. Repetitive transcranial magnetic stimulation (rTMS) has been shown to improve the neuronal excitability and is used to treat psychiatric disorders such as depression. To study the changes of excitatory neuron activity in medial prefrontal cortex (mPFC) in simulated space complex environment (SSCE), and to explore the role of rTMS in behavioral disorders caused by SSCE and the neural mechanism. We found that rTMS effectively ameliorated the emotional and social impairments of mice in SSCE, and acute rTMS could instantaneously enhance the excitability of mPFC neurons. During depression-like and social novelty behaviors, chronic rTMS enhanced the mPFC excitatory neuronal activity that was inhibited by SSCE. Above results suggested that rTMS can completely reverse the SSCE-induced mood and social impairment by enhancing the suppressed mPFC excitatory neuronal activity. It was further found that rTMS suppressed the SSCE-induced excessive dopamine D2 receptor expression, which may be the cellular mechanism by which rTMS potentiates the SSCE-evoked hypoactive mPFC excitatory neurons. Our current results raise the possibility of rTMS being applied as a novel neuromodulation for mental health protection in spaceflight.