Evidence from observational studies indicates that endometriosis and depression often co-occur. However, conflicting evidence exists, and the etiology as well as biological mechanisms underlying their comorbidity remain unknown. Utilizing genome-wide association study (GWAS) data, we comprehensively assessed the relationship between endometriosis and depression. Single nucleotide polymorphism effect concordance analysis (SECA) found a significant genetic overlap between endometriosis and depression (PFsig-permuted = 9.99 × 10-4). Linkage disequilibrium score regression (LDSC) analysis estimated a positive and highly significant genetic correlation between the two traits (rG = 0.27, P = 8.85 × 10-27). A meta-analysis of endometriosis and depression GWAS (sample size = 709,111), identified 20 independent genome-wide significant loci (P < 5 × 10-8), of which eight are novel. Mendelian randomization analysis (MR) suggests a causal effect of depression on endometriosis. Combining gene-based association results across endometriosis and depression GWAS, we identified 22 genes with a genome-wide significant Fisher's combined P value (FCPgene < 2.75 × 10-6). Genes with a nominal gene-based association (Pgene < 0.05) were significantly enriched across endometriosis and depression (Pbinomial-test = 2.90 × 10-4). Also, genes overlapping the two traits at Pgene < 0.1 (Pbinomial-test = 1.31 × 10-5) were significantly enriched for the biological pathways 'cell-cell adhesion', 'inositol phosphate metabolism', 'Hippo-Merlin signaling dysregulation' and 'gastric mucosa abnormality'. These results reveal a shared genetic etiology for endometriosis and depression. Indeed, additional analyses found evidence of a causal association between each of endometriosis and depression and at least one abnormal condition of gastric mucosa. Our study confirms the comorbidity of endometriosis and depression, implicates links with gastric mucosa abnormalities in their causal pathways and reveals potential therapeutic targets for further investigation.