BackgroundDepression is increasingly recognized as a factor affecting infertility and the causal relationship between them remains controversial. The aim of this study was to explore the relationship between depression and infertility using Mendelian randomization (MR) and cross-sectional study, and to explore the potential mediating role of obesity.MethodsThe cross-sectional study used data from the National Health and Nutrition Examination Survey (NHANES) 2013-2018. Multivariable-adjusted logistic regression was used to assess the association between depression and infertility risk, and mediation analysis was to examine the mediating effect of obesity. Then, we performed MR analyses to investigate the causal effect of depression on infertility. Instrumental variables for depression were obtained from a genome-wide association meta-analysis (135,458 cases and 344,901 controls), and summary level data for infertility were obtained from the FinnGen database (6,481 cases and 68,969 controls).ResultsIn the cross-sectional study, a total of 2,915 participants between the ages of 18 and 45 were included, of whom 389 were infertile. We observed that depression was strongly associated with an increased risk of infertility (OR=1.66, 95%CI: 1.19, 2.33), and this relationship remained significant in mild (OR=1.45, 95% CI: 1.09, 1.93), moderate (OR=1.89, 95% CI: 1.26, 2.84), and severe depression (OR=1.74, 95% CI: 1.02, 2.99). Mediation analysis showed that obesity mediated 7.15% and 15.91% of the relationship between depression and infertility for body mass index and waist circumference. Furthermore, depression significantly increased the risk of infertility in both the general obesity (OR=1.81, 95%CI=1.20-2.73, P<0.01) and abdominal obesity populations (OR=1.57, 95%CI=1.08-2.27, P=0.02) populations. In addition, the MR analysis also revealed a significant positive causal relationship between genetically predicted depression and infertility (OR=1.32, 95% CI: 1.03, 1.70).ConclusionDepression is associated with an increased risk of infertility, with obesity playing a significant mediating role. This study underscores the importance of incorporating mental health and weight management in infertility treatment strategies.