Introduction

Osteoporosis (OP) is a systemic skeletal disorder characterized by decreased bone mass and the deterioration of bone microstructure, which leads to heightened bone fragility and an elevated risk of fracture [1]. Clinical diagnosis primarily relies on dual-energy X-ray absorptiometry (DXA) assessment, which measures bone mineral density (BMD) at central sites, such as the lumbar spine and proximal femur, and peripheral sites, including the distal forearm [2]. Recently, the heel site has also been utilized for the estimation of BMD [3]. In recent years, owing to the worldwide increase in the aging population, OP has shown a greater prevalence among the general public, with a global incidence rate of 19.7%. The incidence rate is 10.6% for males and 24.8% for females, notably more prevalent in developing countries than in developed nations [4]. The primary complications of OP manifest mainly as fragility fractures, with hip and vertebral compression fractures being the most severe. These fractures result in severe pain and may lead to disability or even mortality [5]. The costs of treating OP are significant in many countries and are expected to increase, placing a substantial burden on both individuals and society [6].

Metformin is widely utilized in clinical practice as a first-line antidiabetic medication for type 2 diabetes patients due to its cost-effectiveness, efficacy, and minimal adverse effects [7]. Accumulating evidence indicates that, in addition to its hypoglycemic properties, metformin exerts a beneficial effect on OP. Previous observational studies have suggested that metformin therapy may positively affect BMD [8, 9] and reduce the risk of OP [10]. In vitro and animal experiments have revealed that metformin can promote osteoblast differentiation, increase osteogenic protein expression [11], and inhibit osteoblast apoptosis [12]. However, one study showed that metformin had no osteogenic effect in ovariectomized mice [13]. The relationship between metformin usage and OP incidence remains contentious, likely due to differences in statistical methods, study designs, inclusion criteria, small sample sizes, subject characteristics, and endpoint assessments. The limited sample size introduces bias, resulting in insufficient evidence to draw definitive conclusions in these studies. Thus, further research is essential to elucidate their relationship. The randomized controlled trial (RCT) is considered the gold standard for establishing causality between a medically significant exposure and its outcome. Conducting RCTs is hindered by their high costs, resource demands, time-intensive nature, and ethical constraints, rendering them impractical or challenging to undertake [14].

Mendelian randomization (MR) is a genetic epidemiological approach that is considered akin to RCTs. Two-sample MR studies employ single-nucleotide polymorphisms (SNPs) linked to the exposure of interest as instrumental variables (IVs) to infer causal relationships between exposure and outcomes. The association estimates (summary statistics) between genotype and the exposure, as well as between genotype and the outcome, are derived or collected from two distinct datasets, often with limited or no overlapping individuals [15]. In contrast to traditional observational epidemiological studies, MR studies provide unique advantages. Firstly, as allele variants are randomly assigned during gamete formation, occurring prior to the observation over time, and given that genotypes remain unaffected by the disease, MR is less vulnerable to confounding and reverse causality [16]. Secondly, utilizing high-precision gene sequencing permits the prevention of regression dilution bias resulting from measurement errors [17]. In this study, a two-sample MR analysis is employed to investigate the causative link between metformin treatment and OP, BMD, and fractures. This research is aimed at providing recommendations for the treatment and prevention of OP.

Methods

Study design

Metformin treatment is examined as the exposure variable in this study, with outcome measures including OP, femoral neck bone mineral density (FN-BMD), lumbar spine bone mineral density (LS-BMD), and forearm bone mineral density (FA-BMD), estimated heel bone mineral density (eBMD), and fracture. To conduct the MR investigation, three key assumptions must be met: first, the selected SNPs should demonstrate a significant association with the exposure (metformin treatment); second, the chosen SNPs as IVs for the exposure must be independent of other potential confounding factors; and third, the SNPs should solely affect the outcomes (OP, BMD, and fracture) through their influence on the exposure, avoiding horizontal pleiotropy. Our analysis utilized published studies or publicly available genome-wide association study (GWAS) summary data, all of which had obtained subjects’ consent and ethical approval.

GWAS data sources

GWAS source for metformin treatment

The summary data for metformin treatment GWAS was obtained from the analysis of UK Biobank data, using a genome-wide association tool based on a generalized linear mixed model. The study included 456,276 participants of European origin, comprising of 11,358 cases and 444,918 controls [18]. Participants were categorized based on their use of metformin, without consideration for age or gender, to determine case/control status.

GWAS source for OP

Summary statistics for OP can be obtained from the IEU OpenGWAS database, using the TwoSampleMR (v 0.5.7) analysis package [19], via the specific ID “finn-b-M13_OSTEOPOROSIS” [20]. The GWAS was conducted by the FinnGen consortium involving 212,778 participants of European ancestry, with 3204 cases and 209,575 controls.

GWAS summary data for BMD

OP is characterized by diminished BMD and an elevated susceptibility to fractures. BMD, as a crucial indicator of skeletal strength and a highly heritable trait, is commonly employed in the clinical diagnosis of OP [21, 22]. As BMD levels can serve as an indicator of the extent of OP, we employed GWAS summary statistics for BMD to expand the overall sample size comprehensively, thereby enhancing the accuracy of subsequent causal effects. In this study, we utilized three GWAS statistical summaries from the GEnetic Factors for Osteoporosis (GEFOS) Consortium website(http://www.gefos.org/?q=content/data-release-2015) [23] published FN-BMD (n = 32,735), LS-BMD (n = 28,498), and FA-BMD (n = 8,143) in European participants; this is the largest GWAS to date on DXA-measured BMD. The GWAS summary data for eBMD (n = 426,824) were obtained from GEFOS, the most extensive GWAS to date for the peripheral skeletal site(http://www.gefos.org/?q=content/data-release-2018) [24]. The data at the summary level for eBMD were derived from measurements employing quantitative ultrasound.

GWAS summary data for fracture

The GWAS summary data for both fracture (53,184 cases and 373,611 controls) were obtained from GEFOS(http://www.gefos.org/?q=content/data-release-2018) [24]. Fracture was defined using ICD-10 diagnostic codes, where the codes for skull, face, hand, and foot fractures, pathological fractures caused by malignant tumors, atypical femoral fractures, periprosthetic fractures, and healed fractures were excluded.

Selection of genetic instrumental variables

Initially, we selected the genetic variants associated with metformin treatment that exhibited genome-wide significance (P < 5 × 10-8) from the GWAS summary data for metformin treatment as IVs. Subsequently, we conducted an analysis was conducted using linkage disequilibrium (LD) parameters (r2 < 0.001, kb = 10,000) to identify independent SNPs as IVs, aiming to prevent bias arising from linkage disequilibrium. Thirdly, we extracted and organized data from the outcome (OP, BMD, and fracture) GWAS summary datasets that included the aforementioned SNPs to ensure that the effect of a SNP on the exposure, and the effect of that same SNP on the outcome, corresponds to the same allele. In the fourth phase, we removed SNPs related to potential confounding factors, in accordance the presumptions delineated in assumptions 2 and 3 within MR studies. We meticulously examined these selected SNPs individually through interrogation within the PhenoScanner database [25] and removed those exhibiting significant associations at the genome-wide level with other confounding elements, such as the utilization of pioglitazone, systemic lupus erythematosus, and high-density lipoprotein cholesterol. Additionally, during the analysis of FA-BMD, arm muscle mass and hand grip strength were excluded as potential confounding factors, due to the observed correlation between grip strength and forearm bone parameters, as well as the positive association of BMD with lean body mass and its negative association with fat mass [26, 27]. Finally, we employed these rigorously selected SNPs as IVs for the subsequent two-sample MR analysis.

In adherence to the tenets of MR analysis, it is imperative that the chosen IVs evince a robust and discernible correlation with the exposure. In this particular study, we endeavored to quantify the magnitude of this association between IVs and the exposure factor by employing the computation of the F-statistic for individual SNPs [28]. The mathematical expression for the F-statistic is encapsulated as follows: \(F=\frac{{R}^{2}}{1-{R}^{2}}\times \frac{N-K-1}{K}\). In this context, the variable N designates the sample size encompassed within the GWAS pertaining to the exposure, K denotes the count of IVs, and R2 represents the interpretation of exposure variance for the selected SNPs. Specifically,\({R}^{2}=2\times {\text{MAF}}\times (1-MAF)\times {(\frac{\beta }{SD})}^{2}\), wherein MAF signifies the frequency of the minor allele, β captures the genetic effect of the SNP on the exposure, and SD denotes the standard deviation. Here, \({\text{SD}}={\text{SE}}\times \surd N\).

If the calculated F-statistic for the instrumental variable exceeds the threshold of 10, it is appropriate to assume that the instrumental variable is minimally susceptible to weak instrument bias[29].

MR analysis

The inverse variance weighting (IVW) methodology is the primary analytical approach used in this investigation to establish causal inferences regarding the impact of metformin treatment on OP, BMD, and fracture outcomes. IVW is effective in assessing both outcome precision and reliability [30], as well as determining causal relationships. Additionally, Cochran’s Q test is utilized to evaluate heterogeneity. When the P value obtained from Cochran’s Q test falls below the threshold of 0.05, indicating significant heterogeneity, the MR analysis concludes with the random-effects IVW. Conversely, fixed-effects IVW is employed when heterogeneity is absent. Furthermore, ancillary analyses, encompassing the weighted median (WM), penalized weighted median (PWM), maximum likelihood (ML), and MR-Egger regression (MR-Egger) method, are carried out to corroborate and substantiate the findings originating from the IVW approach [31, 32]. These supplementary analyses collectively contribute to a comprehensive validation of the causal inferences drawn within this study.

Sensitivity analysis

Within this MR study, a thorough sensitivity analysis was conducted. This analysis included the use of Cochran’s Q statistic, MR-Egger regression, and leave-one-out sensitivity assessment. Cochran’s Q test is utilized to examine differences among the diverse instrumental variables, with a larger difference indicating increased heterogeneity [33]. MR-Egger regression plays a pivotal role in the examination of pleiotropy by assessing the intercept term. When the P value derived from the MR-Egger intercept descends below the significance threshold of 0.05, it signifies the existence of horizontal pleiotropy. Conversely, a P value exceeding 0.05 signifies the absence of horizontal pleiotropy [34]. Mendelian Randomization Pleiotropy Residual Sum and Outlier (MR-PRESSO) was used to identify outliers and provide a corrected estimation [35]. This allowed for rectification of any issues and ensured the accuracy of our results. In addition to these methodologies, the leave-one-out test was executed to ascertain whether the IVW estimate was predisposed to bias stemming from the influence of individual SNPs.

Statistical analysis

All statistical analyses were performed meticulously using the “TwoSampleMR” and “MRPRESSO” packages within the R software (version 4.3.0). The P value fell below the threshold significance level of 0.05 to establish statistical significance.

Results

Utilizing the R Studio software, we conducted an intricate instrumental variable selection process. Initially, we select SNPs that showed a significant association with metformin treatment (P < 5 × 10−8) within the GWAS dataset. Subsequently, we established linkage disequilibrium parameters (r2 = 0.001, kb = 10000), culminating in the selection of 46 distinct SNPs. Next, we extracted data for the above-selected SNPs from the summary statistics of outcome trait (OP, LS-BMD, FN-BMD, and FA-BMD). Allele alignment was performed, and during this harmonization process, SNPs with inconsistent alleles and those with ambiguous palindromic SNPs that could not be corrected were removed. Subsequently, we employed the Phenoscanner database to interrogate phenotypes associated with the remaining SNPs. SNPs (specifically, rs34872471, rs780093, and rs849142) displaying associations with potential confounding factors such as pioglitazone, systemic lupus erythematosus, and high-density lipoprotein cholesterol were expunged, with a significance threshold set at P < 5E − 8. When exploring the causal effect of metformin treatment on forearm bone density, it was determined that SNPs linked to arm muscle mass and hand grip strength (rs780093, rs8756, rs4715207, rs1421085, rs76895963, rs947791, rs10195252, rs1483988, rs459193, and rs12146652) were excluded as possible confounding factors in addition to the three SNPs previously mentioned. The outliers identified by MR-PRESSO have been eliminated. Additionally, we computed the F-statistic for every SNP, and all of them exceeded the noteworthy threshold of 10. This observation attested to the substantial instrumental strength of these SNPs, thereby ensure the robustness of our ensuing MR analysis.

Ultimately, we employed 34, 34, 34, 24, 24, and 34 SNPs, respectively, as instrumental variables for the evaluation of metformin treatment's impact on outcomes, encompassing OP (Supplementary Table 1), LS-BMD (Supplementary Table 2), FN-BMD (Supplementary Table 3), FA-BMD (Supplementary Table 4), eBMD (Supplementary Table 5), and fracture (Supplementary Table 6).

Effect of metformin on osteoporosis

MR analysis

Based on the inverse variance weighting (IVW) analysis outcomes, our findings unveiled a causal association between metformin treatment and a diminished risk of osteoporosis (OR: 0.859, 95% CI: 0.774–0.953, P = 0.004). This observation was corroborated by the weighted median (WM) method (OR: 0.830, 95% CI: 0.724–0.951, P = 0.007), Mendelian randomization-Egger (MR-Egger) analysis (OR: 0.646, 95% CI: 0.462–0.902, P = 0.015), penalized weighted Median (PWM) analysis (OR: 0.828, 95% CI: 0.722–0.950, P = 0.007), and maximum likelihood (ML) analysis (OR: 0.858, 95% CI: 0.781–0.943, P = 0.001). These diverse analytical approaches collectively yielded consistent outcomes (Fig. 1). Supplementary Fig. 1 shows the scatter plot of the above five methods for the association of metformin treatment with risk of OP.

Fig. 1
figure 1

Causal effects for metformin treatment on OP. MR-Egger, weighted median, inverse-variance weighted, penalized weighted median, and maximum likelihood estimates of Mendelian randomization are summarized. CI, confidence interval; nSNP, number of single nucleotide polymorphism; OR, odds ratio

Sensitivity analysis

Our comprehensive analysis of heterogeneity indicates the lack of significant heterogeneity in the IVW analysis (Cochran’s Q = 41.53, P = 0.146) and the MR-Egger analysis (Cochran’s Q = 37.89, P = 0.219) (Table 1). Furthermore, our analysis revealed no significant evidence of horizontal pleiotropy, as indicated by both the MR-Egger intercept test (P = 0.09), with P values exceeding the 0.05 threshold (Table 1). MR-PRESSO did not identify any outliers.

Table 1 Pleiotropy and heterogeneity test for metformin treatment on OP

Furthermore, our study conducted leave-one-out tests and found that the causal influence of metformin treatment on osteoporosis remained constant even when individual SNPs were excluded (Supplementary Fig. 2). This confluence of results indicates the stability and reliability of our analysis regarding the causal relationship between metformin treatment and osteoporosis.

Effect of metformin treatment on BMD

MR analysis

In our quest to delve deeper into the potential causal impact of metformin treatment on bone density at distinct anatomical sites, we conducted comprehensive MR analyses. The outcomes of our investigation revealed a positive correlation between metformin treatment and LS-BMD (IVW: OR: 1.063, 95% CI: 1.023–1.105, P = 0.002; MR-Egger: OR: 1.197, 95% CI: 1.047–1.367, P = 0.013; ML: OR: 1.066, 95% CI: 1.032–1.102, P = 0.017; Fig. 2), FN-BMD (IVW: OR: 1.034, 95% CI: 1.000–1.069, P = 0.049; MR-Egger: OR: 1.145, 95% CI: 1.020–1.284, P = 0.028; ML: OR: 1.035, 95% CI: 1.006–1.065, P = 0.016; Fig. 2) and eBMD (IVW: OR: 1.035, 95%CI: 1.023–1.047, P ≤ 0.001; MR-Egger: OR: 1.036, 95%CI: 1.010–1.062, P = 0.012; ML: OR: 1.036, 95%CI: 1.028–1.043, P ≤ 0.001; WM: OR: 1.032, 95%CI: 1.021–1.042, P ≤ 0.001; PWM: OR: 1.032, 95%CI: 1.021–1.042, P ≤ 0.001). The WM and PWM results for LS-BMD and FN-BMD analyses aligned with the IVW outcomes, albeit with somewhat diminished significance (LS-BMD: WM: OR: 1.043, 95% CI: 0.994–1.093, P = 0.084; PWM: OR: 1.033, 95% CI: 0.984–1.085, P = 0.186; Fig. 2. FN-BMD: WM: OR: 1.022, 95% CI: 0.980–1.066, P = 0.307; PWM: OR: 1.004, 95% CI: 0.963–1.046, P = 0.853; Fig. 2). However, no causal relationship was observed between metformin treatment and FA-BMD (IVW: OR: 1.050, 95% CI: 0.969–1.138, P = 0.237; Fig. 2). As shown in Fig. 2, WM, MR-Egger, PWM, and ML analyses consistently yielded analogous non-significant results (P < 0.05). It is worth noting that due to the detection of heterogeneity, we employed the random-effects IVW method to assess the causal associations between metformin treatment and LS-BMD, FN-BMD, FA-BMD, and eBMD. Supplementary Fig. 3 shows the scatter plot of the above five methods for the association of metformin treatment with LS-BMD, FN-BMD, FA-BMD, and eBMD.

Fig. 2
figure 2

Causal effects for metformin treatment on LS-BMD, FN-BMD, and FA-BMD and eBMD. MR-Egger, weighted median, inverse-variance weighted, penalized weighted median, and maximum likelihood estimates of Mendelian randomization are summarized. LS-BMD, lumbar spine bone mineral density; FN-BMD, femoral neck bone mineral density; FA-BMD, forearm bone mineral density; eBMD, estimated heel bone mineral density; CI, confidence interval; nSNP, number of single nucleotide polymorphism; OR, odds ratio

Sensitivity analysis

In the evaluation of heterogeneity, noteworthy findings emerged from the heterogeneity tests concerning LS-BMD (IVW: Cochran’s Q = 48.81, P = 0.038), FN-BMD (IVW: Cochran’s Q = 47.70, P = 0.047), FA-BMD (MR-Egger: Cochran’s Q = 34.45, P = 0.044), and eBMD (MR-Egger: Cochran’s Q = 62.578, P ≤ 0.001; IVW: Cochran’s Q = 62.593, P ≤ 0.001) (Table 2). However, no significant evidence of horizontal pleiotropy was observed based on the MR-Egger intercept tests (LS-BMD: P = 0.081; FN-BMD: P = 0.082; FA-BMD: P = 0.789; eBMD: P = 0.940) (P > 0.05) (Table 2). The MR-PRESSO analysis identified outliers in eBMD, leading to their exclusion from the dataset (rs10965246, rs11257655, rs11708067, rs1421085, rs2215383, rs459193, rs7177055, rs7615045, rs76895963, rs849142, rs8756, and rs947791). No outliers were detected in LS-BMD, FN-BMD, and FA-BMD. Furthermore, in the leave-one-out tests, no individual SNP was identified as exerting an influential effect on the causal relationship between metformin treatment and bone mineral density(Supplementary Fig. 4).

Table 2 Pleiotropy and heterogeneity test for metformin treatment on LS-BMD, FN-BMD, FA-BMD, and eBMD

Effect of metformin on fracture

MR analysis

Our investigation has revealed that the metformin treatment is causally associated with a reduced risk of fractures (IVW: OR: 0.958, 95% CI: 0.928–0.989, P = 0.008; WM: OR: 0.957, 95% CI: 0.9223–0.993, P = 0.021; ML: OR: 0.957, 95% CI: 0.934–0.981, P ≤ 0.001; PWM: OR: 0.957, 95% CI: 0.922–0.994, P = 0.023; Fig. 3). The MR-Egger analyses concurred with the IVW results, albeit the significance was somewhat weakened (OR: 0.920, 95% CI: 0.824–1.029, P = 0.154; Fig. 3). Supplementary Fig. 5 shows the scatter plot of the above five methods for the association of metformin treatment with risk of fracture.

Fig. 3
figure 3

Causal effects for metformin treatment on fracture. MR-Egger, weighted median, inverse-variance weighted, penalized weighted median, and maximum likelihood estimates of Mendelian randomization are summarized. CI, confidence interval; nSNP, number of single nucleotide polymorphism; OR, odds ratio

Sensitivity analysis

There is a significant degree of heterogeneity present in both the IVW analysis (Cochran’s Q = 58.378, P = 0.003) and the MR-Egger analysis (Cochran’s Q = 59.358, P = 0.003) (Table 3). Nevertheless, the MR-Egger intercept tests showed no significant evidence of horizontal pleiotropy(P = 0.473) (Table 3). The MR-PRESSO analysis detected outliers and we subsequently excluded them from the dataset (rs1483988 and rs34872471).

Table 3 Pleiotropy and heterogeneity test for metformin treatment on fracture

Additionally, the leave-one-out tests did not identify any individual SNP that significantly affected the causal relationship between receiving metformin treatment and the risk of fractures (Supplementary Fig. 6).

Discussion

In this two-sample Mendelian randomization study, genetic predictions were used to reveal a significant causal association between the metformin treatment and a considerable decrease in osteoporosis and fracture risk in the European population. Furthermore, our study suggests a plausible beneficial influence of metformin on LS-BMD, FN-BMD, and eBMD. However, no discernible causal relationship appears to exist between metformin treatment and FA-BMD. It is noteworthy to acknowledge that the adult skeletal framework is predominantly composed of cortical bone (80%) and trabecular bone (20%). Additionally, the proportional composition of cortical and trabecular bone exhibits variations across distinct anatomical locations. For instance, vertebral structures display a cortical to trabecular bone ratio of 25:75, and the trabecular bone content in the calcaneus is 90%, while the femoral head manifests a more balanced 50:50 ratio. In contrast, the radial shaft boasts the highest composition of cortical bone, featuring a ratio of 95:5 [36]. This is in contrast to the lumbar vertebrae, femoral head, and calcaneus, which have a relatively larger proportion of trabecular bone. The differing effects of metformin treatment on BMD across varying skeletal regions may be related to these variations in cortical and trabecular bone ratios.

Our research findings are in concordance with previous investigations. For instance, a retrospective study encompassing 11,458 patients afflicted with type 2 diabetes mellitus (T2DM), of which 2722 received metformin therapy, elucidated a discernible association between metformin treatment and elevated T-scores, alongside a decreased incidence of OP and diminished BMD in comparison to patients not subjected to metformin treatment [9]. A cross-sectional study showed that the utilization of metformin results in a reduction in the susceptibility to osteoporosis among adult females, irrespective of the presence of T2DM or obesity [37]. In one Diabetes Prevention Program Outcomes Study (DPPOS), bone mineral density assessments were carried out on 1367 participants, uncovering that the metformin group exhibited heightened total hip joint BMD and femoral neck BMD in contrast to the placebo group. Nevertheless, when the analysis was stratified by gender, the results did not attain statistical significance [38]. It is noteworthy, however, that some research has indicated the absence of a substantial correlation between metformin utilization and the risk of hip fractures [39]. The contrasting conclusions may be ascribed to the predominantly observational nature of these studies, which renders it arduous to mitigate the interference of unobserved confounding factors.

The principal pathogenesis of osteoporosis revolves around the disruption of bone metabolism, characterized by an imbalance between bone formation and resorption, ultimately culminating in a significant reduction in bone mass and density [40]. Currently, several potential mechanisms have been proposed to elucidate the impact of metformin on osteoporosis. At the cellular level, metformin instigates osteoblast differentiation by activating AMP-activated protein kinase (AMPK), inducing the expression of Small Heterodimer Partner (SHP) and Runt-related transcription factor 2 (Runx2), and augmenting the transcription of the osteocalcin gene [41]. Furthermore, metformin exerts an inhibitory effect on osteoclast differentiation by stimulating the synthesis of osteoprotegerin (OPG) while concurrently inhibiting the production of the receptor activator of nuclear factor-kappa B ligand (RANKL) within osteoblasts [42]. In light of genetic correlation and Mendelian randomization analysis, we furnish substantiation that the utilization of metformin can attenuate the risk of osteoporosis. This study provides new evidence supporting the use of metformin for preventing and treating osteoporosis. Especially noteworthy is the fact that metformin has no substantial impact on glucose levels in non-diabetic individuals. In individuals with diabetes, in addition to the positive osteogenic effects of metformin, the glycemic control achieved through metformin may also contribute to bone formation [43]. These findings enable the broad utilization of metformin as a preventative and therapeutic intervention in individuals at an elevated risk of osteoporosis.

There are some strengthens in our analysis. Firstly, MR analysis hinges on the random allocation of genetic variations during conception, rendering it less susceptible to individual selection bias or behavioral interference. This emulation of conditions akin to a randomized clinical trial ensures more reliable results for causal inference [44]. Secondly, the utilization of distinct datasets for exposure and outcomes minimizes the biases inherent in weak instrumental variable approaches, augmenting the efficacy of two-sample MR analysis [45]. Thirdly, the incorporation of six sets of genome-wide association study summary data as outcome data enhances the sample size and improves the accuracy of estimated causal effects. Fourthly, a stringent criterion was instituted for instrumental variable selection, allowing only SNPs significantly associated with metformin treatment and adhering to the three core assumptions of MR analysis to serve as instruments [46]. Furthermore, genetic variation is dispersed across various chromosomes, thereby mitigating the potential influence of gene–gene interactions on effect estimates [47]. Finally, a diverse array of analytical methods, encompassing tests for heterogeneity, assessments of horizontal pleiotropy, and the leave-one-out analysis, were deployed to evaluate the validity of the instrumental variable assumption.

Our study does have several limitations. Firstly, we observed heterogeneity in the analysis. Due to our use of GWAS data, we were unable to investigate potential non-linear relationships or stratified effects based on variables such as age, health status, or gender, which could contribute to the observed heterogeneity. Secondly, we only excluded SNPs related to known confounding factors, and there may be additional, unidentified confounding factors that influence the association between metformin and osteoporosis, warranting further investigation. Thirdly, the relatively modest sample size of osteoporosis (OP) data from FinnGen and does not allow to look at specific categories of the fractures among the OP category (e.g., hip and forearm). Consequently, we focused on analyzing the impact of metformin treatment on the overall risk of fractures. Further research should investigate the association between metformin treatment and fracture risk at various anatomical sites to provide a more comprehensive understanding of its effects. Lastly, our study primarily comprises individuals of European ancestry, which may limit the generalizability of our results to non-European populations. Further research is required to validate the applicability of these findings in other populations or ethnic groups.

Conclusion

In conclusion, this two-sample Mendelian randomization study suggests a causal relationship wherein metformin treatment is associated with a reduced risk of OP and fractures and an increase in BMD. It should be noted, however, that the impact of metformin on BMD might vary due to differences in the composition of bone tissue in different regions of the skeleton. For instance, there is a positive influence on BMD in skeletal regions where trabecular bone predominates (e.g., lumbar spine, femoral head, and calcaneus), while the impact on regions with a higher proportion of cortical bone (such as the forearm) is not significant. These results provide novel evidence supporting the potential of metformin as an efficacious preventive agent for OP. This finding could have important implications for the prevention and treatment of OP. Further research is needed to verify the protective impact of metformin treatment against OP, as well as to carry out extensive randomized controlled trials to affirm our Mendelian randomization conclusions.