Major depressive disorder (MDD) is characterized by substantial comorbidity with medical conditions. To achieve better outcomes for patients with MDD, an improved understanding of the mechanisms underlying pervasive comorbidities is required. Here, to this end, we mapped patterns of pleiotropy by defining four clusters of physical diseases (cardiovascular, metabolic, gastrointestinal and immune) and analyzed their genetic relationships with MDD using genomic structural equation modeling. Three disease clusters exhibited independent associations with MDD and accounted for 47% of MDD h2SNP, with the gastrointestinal disease cluster having the strongest association (β = 0.63, s.e. = 0.05, P = 3.04 × 10-30). In addition, we identified independent loci associated with the shared genetic liability between each disease cluster and MDD, revealing different pleiotropic components. Characterization of these loci revealed previously unidentified associations with MDD and physical disease traits, along with unique biological pathways, drug groups, cell types and genes associated with each disease-MDD cluster. Our findings reveal genetic connections implicating the gut-brain axis as a key mechanism underlying the comorbidity of physical diseases in MDD. This work advances our understanding of MDD by highlighting unique and shared genetic components across different disease systems.