Digestive system diseases are common in the population and may have a potential relationship with erectile dysfunction (ED), however, there are few studies on the effect of digestive system diseases on ED, and its relationship is not clear. This study aims to investigate the causal relationship between digestive system diseases and ED, and assesses their potential mechanisms and effect sizes. Our study included the genome-wide association studies (GWAS) datasets for 23 digestive system diseases to retrieve single nucleotide polymorphisms (SNPs), employing the univariable Mendelian randomization (MR) approach for analysis. Additionally, we utilized multivariable Mendelian randomization (MVMR) to investigate the direct causal effects between exposure and ED. Through MR analysis, we found that celiac disease (OR: 1.08, 95% CI: 1.01–1.16, p = 0.03), Crohn's disease (OR: 1.06, 95% CI: 1.01–1.12, p = 0.04), colorectal cancer (OR: 1.18, 95% CI: 1.03–1.35, p = 0.02), and primary sclerosing cholangitis (OR: 1.10, 95% CI: 1.04–1.18, p = 0.003) are positively associated with the risk of ED. Gastric cancer (OR: 0.91, 95% CI: 0.84–0.99, p = 0.03) is negatively associated with the risk of ED. After adjusting for BMI, alcohol consumption, and smoking by MVMR, we found that only Crohn's disease and colorectal cancer had a direct causal effect on ED. Based on MR analysis of the association between 23 digestive system diseases and ED, we identified 5 digestive system diseases causally related to ED. These identified digestive diseases can be used as early warning factors for future clinical monitoring of patients' erectile function status. This provides a theoretical basis for attending to the sexual health of male patients concerned with digestive system diseases.