Magnesium-based implants facilitate bone regeneration via degradation. However, the epigenetic mechanisms, particularly N6-methyladenosine (m6A) modification regulated by Mg2+, remain incompletely understood. This study investigated the role of Mg2+ in osteogenic differentiation through the METTL3-RhoA axis and evaluated its potential in intervertebral fusion. The optimal Mg2+ concentration was identified using MC3T3-E1 cells. Methylated RNA immunoprecipitation sequencing (MeRIP-seq) and MeRIP-PCR were employed to identify m6A target genes. Functional assays (knockdown, overexpression, and rescue) validated the METTL3-YTHDF1-RhoA pathway. A rat tail intervertebral fusion model with magnesium implants was used to assess in vivo effects. Treatment with 4 mM Mg2+ significantly enhanced osteogenic activity and increased METTL3 levels. Mechanistically, METTL3 promoted m6A methylation of RhoA mRNA, which was subsequently bound by YTHDF1, enhancing translation and activating the RhoA/ROCK pathway. In vivo, magnesium implants accelerated fusion and improved trabecular bone quality; however, these effects were inhibited by METTL3 or RhoA inhibitors. Mg2+ enhances osteogenic differentiation through the METTL3-YTHDF1-RhoA/ROCK pathway. This study provides an epigenetic framework for optimizing magnesium-based orthopedic implants and suggests that targeting the m6A-RhoA axis could improve spinal fusion outcomes.