Leveraging real-world clinical biobanks to investigate the associations between genetic and environmental risk factors for mental illness may help direct clinical screening efforts and evaluate the portability of polygenic scores across environmental contexts. To examine the associations between sexual trauma, polygenic liability to mental health outcomes, and clinical diagnoses of schizophrenia, bipolar disorder, and major depressive disorder in a clinical biobank setting. This genetic association study was conducted using clinical and genotyping data from 96 002 participants across hospital-linked biobanks located at Vanderbilt University Medical Center (VUMC), Nashville, Tennessee (including 58 262 individuals with high genetic similarity to the 1000 Genomes Project [1KG] Northern European from Utah reference population [1KG-EU-clustered] and 11 047 with high genetic similarity to the 1KG African-ancestry reference population of Yoruba in Ibadan, Nigeria [1KG-YRI-clustered]), and Mass General Brigham (MGB), Boston, Massachusetts (26 693 individuals with high genetic similarity to the combined European-ancestry superpopulation [1KG-EU-clustered]). Clinical data analyzed included diagnostic billing codes and clinical notes spanning from 1976 to 2023. Data analysis was performed from 2022 to 2024. Clinically documented sexual trauma disclosures and polygenic scores for schizophrenia, bipolar disorder, and major depressive disorder. Diagnoses of schizophrenia, bipolar disorder, and major depressive disorder, determined by aggregating related diagnostic billing codes, were the dependent variables in logistic regression models including sexual trauma disclosure status, polygenic scores, and their interactions as the independent variables. Across the VUMC and MGB biobanks, 96 002 individuals were included in analyses (VUMC 1KG-EU-clustered: 33 011 [56.7%] female; median [range] age, 56.8 [10.0 to >89] years; MGB 1KG-EU-clustered: 14 647 [54.9%] female; median [range] age, 58.0 [10.0 to >89] years; VUMC 1KG-YRI-clustered: 6961 [63.0%] female; median [range] age, 44.6 [10.1 to >89] years). Sexual trauma history was associated with all mental health conditions across institutions (ORs ranged from 8.83 [95% CI, 5.50-14.18] for schizophrenia in the VUMC 1KG-YRI-clustered cohort to 17.65 [95% CI, 12.77-24.40] for schizophrenia in the VUMC 1KG-EU-clustered cohort). Sexual trauma history and polygenic scores jointly explained 3.8% to 8.8% of mental health phenotypic variance. Schizophrenia and bipolar disorder polygenic scores had greater associations with mental health outcomes in individuals with no documented disclosures of sexual trauma (schizophrenia interaction: OR, 0.70 [95% CI, 0.56-0.88]; bipolar disorder interaction: OR, 0.83 [95% CI, 0.74-0.94]). Sexual trauma and mental health polygenic scores, while correlated with one another, were independent and joint risk factors for severe mental illness in a large, diverse hospital biobank population. Furthermore, associations of schizophrenia and bipolar disorder polygenic scores with respective diagnoses were greater in those without disclosures, suggesting that genetic predisposition to mental illness as measured by polygenic scores may be less impactful in the presence of this severe environmental risk factor.