Gastrointestinal infections can be life threatening, but not much is known about the host's genetic contribution to susceptibility to gastrointestinal infections or the latter's association with psychiatric disorders. We utilized iPSYCH, a genotyped population-based sample of individuals born between 1981 and 2005 comprising 65,534 unrelated Danish individuals (45,889 diagnosed with mental disorders and 19,645 controls from a random population sample) in which all individuals were linked utilizing nationwide population-based registers to estimate the genetic contribution to susceptibility to gastrointestinal infections, identify genetic variants associated with gastrointestinal infections, and examine the link between gastrointestinal infections and psychiatric and neurodevelopmental disorders. The SNP heritability of susceptibility to gastrointestinal infections ranged from 3.7% to 6.4% on the liability scale. Significant correlations were found between gastrointestinal infections and the combined group of mental disorders (OR = 2.09; 95% CI: 1.82-2.4, P = 1.87 × 10-25). Correlations with autism spectrum disorder, attention deficit hyperactivity disorder, and depression were also significant. We identified a genome-wide significant locus associated with susceptibility to gastrointestinal infections (OR = 1.13; 95% CI: 1.08-1.18, P = 2.9 × 10-8), where the top SNP was an eQTL for the ABO gene. The risk allele was associated with reduced ABO expression, providing, for the first time, genetic evidence to support previous studies linking the O blood group to gastrointestinal infections. This study also highlights the importance of integrative work in genetics, psychiatry, infection, and epidemiology on the road to translational medicine.