Diabetes mellitus (DM), a prevalent metabolic disorder, is intricately linked to various infectious diseases. Notably, osteomyelitis (OM), an infection affecting bone tissue, exhibits a higher incidence in individuals with DM. The primary objective of this study was to establish the causal association between DM and OM through Mendelian randomization (MR) analysis while also investigating potential mediating factors that may contribute to this relationship. The study utilized the two-sample Mendelian randomization (TSMR) approach to establish a causal link between type 1 diabetes (T1D), type 2 diabetes (T2D), and OM. The necessary data were obtained from a genome-wide association study, Data on T1D and T2D were obtained from FinnGen Biobank Round 5 Analysis (FINN) and the European Bioinformatics Institute (EBI). In TSMR, the primary analytical method chosen was inverse variance weighting. Additionally, mediation MR analysis was conducted to investigate potential mediators such as glycosylated hemoglobin (HbA1c), fructosamine, and body mass index (BMI). Results of TSMR analysis suggest a positive causal correlation between DM and OM, with DM increasing the risk of OM (T2D(FINN) on OM: odds ratio (OR) = 1.389 95%, confidence interval (CI): 1.215-1.588, P <
.001. T2D(EBI) on OM: OR = 1.217 95%, CI: 1.007-1.470, P <
.042) and T1D(FINN) on OM: OR = 1.140, 95% CI: 1.005-1.293, P = .042. T1D(EBI) on OM: OR = 1.261, 95% CI: 1.072-1.483, P <
.005. Mediation MR results revealed that HbA1c and BMI act as facilitative mediators in the correlation between DM and OM. HbA1c in T1D-OM: OR = 1.379, 95% CI: 1.027-1.853, P <
.001, and BMI in T1D-OM: OR = 1.691, 95% CI: 1.300-2.203, P <
.001. HbA1c in T2D-OM: OR = 1.752, 95% CI: 1.290-2.377, P <
.001, BMI in T2D-OM: OR = 1.788, 95% CI: 1.408-2.267, P <
.001. The findings of this Mendelian randomization study provide evidence for a positive causal association between both 2 types of DM and OM in a European population. Subsequent mediation analysis revealed that HbA1c and BMI played a mediating role in this relationship.