Background: Osteomyelitis (OM) poses a significant clinical challenge, especially among individuals with diabetes mellitus (DM). While both type 1 diabetes mellitus (T1DM) and type 2 diabetes mellitus (T2DM) have been linked to an elevated risk of OM, the precise causal relationships remain uncertain. Methods: We conducted Mendelian randomization (MR) analyses using summary statistics from genome-wide association studies (GWAS) to explore the causal effects of T1DM, T2DM, their complications, and glycemic traits on OM risk. The study utilized the inverse variance weighted (IVW) method, along with weighted median and MR-Egger for causal estimation, and performed various sensitivity analyses to ensure robustness. Multivariable MR (MVMR) analysis assessed direct effects, while two-step mediation MR analyses investigated the mediating role of DM between rheumatoid arthritis (RA) and OM. Results: The MR analysis unveiled distinct causal effects of T1DM and T2DM on OM risk. Genetically determined T2DM, rather than its complications, significantly increased OM risk (primary dataset: IVW: OR = 1.13, 95% CI 1.056-1.209, p = 4E-04; validation dataset: IVW: OR = 1.317, 95% CI 1.14-1.522, p =2E-04; Meta-analysis: OR=1.206; 95% CI 1.037-1.402; p=0.014), with no observable heterogeneity or horizontal pleiotropy. MVMR analysis confirmed the robustness of the causal association between T2DM and OM, even after adjusting for potential confounders such as body mass index. Conversely, T1DM and its complications showed no significant causal link with OM in either the primary dataset (IVW: p = 0.071), the validation dataset (IVW: p = 0.276), or the meta-analysis (IVW: p = 0.242). Additionally, there was no robust evidence supporting the causal risk of glycemic traits on OM. Mediation MR analysis underscored T2DM as a pivotal contributor to the differential effects of RA on OM. Conclusions: Mendelian randomization analysis provides compelling evidence of a significant causal relationship between genetically determined T2DM and increased OM risk, while T1DM exhibits distinct causal effects. Additionally, our findings highlight the role of T2DM in mediating the association between RA and OM. Further research is warranted to elucidate the underlying mechanisms and guide targeted interventions for OM prevention and management in diabetic populations.