Spaceflight-associated immune system weakening ultimately limits the ability of humans to expand their presence beyond the earth's orbit. A mechanistic study of microgravity-regulated immune cell function is necessary to overcome this challenge. Here, we demonstrate that both spaceflight (real) and simulated microgravity significantly reduce macrophage differentiation, decrease macrophage quantity and functional polarization, and lead to metabolic reprogramming, as demonstrated by changes in gene expression profiles. Moreover, we identified RAS/ERK/NFκB as a major microgravity-regulated pathway. Exogenous ERK and NFκB activators significantly counteracted the effect of microgravity on macrophage differentiation. In addition, microgravity also affects the p53 pathway, which we verified by RT-qPCR and Western blot. Collectively, our data reveal a new mechanism for the effects of microgravity on macrophage development and provide potential molecular targets for the prevention or treatment of macrophage differentiation deficiency in spaceflight.