Bone marrow-derived mesenchymal stem cells (BMSCs) are capable of developing into osteoblastic cell lines in vitro and regenerating bone tissue in vivo, and they are considered to be a reliable source for bone regenerative medicine. In recent years, studies have shown that the immune microenvironment is important for osteogenesis, in which macrophages are an important component of innate immunity and coordinate with stem cells. Metformin (Met), a hypoglycemic drug that exerts a powerful effect on metabolic signaling, has been shown to modulate inflammatory responses and osteogenic activity. However, whether metformin modulates macrophage polarization and subsequently affects osteogenesis remains to be elucidated. In the present study, we investigated the potential immunomodulatory capacity of metformin on macrophage inflammatory responses and phenotypic switching, and the subsequent effects on osteogenic differentiation of BMSCs. Flow cytometry and qPCR were used to study the effects of metformin on macrophage phenotypic regulation. qPCR, ALP, ARS and calcium content measurement and ALP activity assay were used to determine the effects of macrophage-secreted activators on the osteogenic differentiation of BMSCs. Our study demonstrates that metformin can improve the immune microenvironment by modulating macrophage polarization towards an anti-inflammatory phenotype, promoting an increase in a range of anti-inflammatory factors and inhibiting pro-inflammatory factors. This was characterized by increased expression of IL-10 and CD206, Arg-1 and decreased expression of IL-1β, TNF-α, IL-6 and iNOS. In addition, metformin-modulated macrophage-conditioned medium promoted osteogenic differentiation of BMSCs, increased the expression levels of genes (ALP, Runx-2, OCN, and Col-1), enhanced ALP activity, and significantly formed mineralized nodules. In conclusion, our new study elucidates that metformin can promote osteogenic differentiation of BMSCs by modulating macrophage phenotype and thereby.