There is emerging evidence that spouses of patients with cancer may have a higher prevalence of mental illness, but these studies have been limited by pre-post designs, focus on a single mental illness, and short follow-up periods. To assess the overall burden of psychiatric disorders among spouses of patients with cancer vs spouses of individuals without cancer and to describe possible changes in this burden over time. This population based cohort study included spouses of patients with cancer (diagnosed 1986-2016 in Denmark and 1973-2014 in Sweden; exposed group) and spouses of individuals without cancer (unexposed group). Members of the unexposed group were individually matched to individuals in the exposed group on the year of birth, sex, and country. Spouses with and without preexisting psychiatric morbidity were analyzed separately. Data analysis was performed between May 2021 and January 2022. Being spouse to a patient with cancer. The main outcome was a clinical diagnosis of psychiatric disorders through hospital-based inpatient or outpatient care. Flexible parametric models and Cox models were fitted to estimate hazard ratios (HRs) with 95% CIs, adjusted for sex, age and year at cohort entry, country, household income, and cancer history. Among 546 321 spouses in the exposed group and 2 731 574 in the unexposed group who had no preexisting psychiatry morbidity, 46.0% were male participants, with a median (IQR) age at cohort entry of 60 (51-68) years. During follow-up (median, 8.4 vs 7.6 years), the incidence rate of first-onset psychiatric disorders was 6.8 and 5.9 per 1000 person-years for the exposed and unexposed groups, respectively (37 830 spouses of patients with cancer [6.9%]; 153 607 of spouses of individuals without cancer [5.6%]). Risk of first-onset psychiatric disorders increased by 30% (adjusted HR, 1.30; 95% CI, 1.25-1.34) during the first year after cancer diagnosis, especially for depression (adjusted HR, 1.38; 95% CI, 1.30-1.47) and stress-related disorders (adjusted HR, 2.04; 95% CI, 1.88-2.22). Risk of first-onset psychiatric disorders increased by 14% (adjusted HR, 1.14; 95% CI, 1.13-1.16) during the entire follow-up, which was similar for substance abuse, depression, and stress-related disorders. The risk increase was more prominent among spouses of patients diagnosed with a cancer with poor prognosis (eg, pancreatic cancer: adjusted HR, 1.41; 95% CI, 1.32-1.51) or at an advanced stage (adjusted HR, 1.31; 95% CI, 1.26-1.36) and when the patient died during follow-up (adjusted HR, 1.29; 95% CI, 1.27-1.31). Among spouses with preexisting psychiatric morbidity, the risk of psychiatric disorders (first-onset or recurrent) increased by 23% during the entire follow-up (adjusted HR, 1.23; 95% CI, 1.20-1.25). In this cohort study of 2 populations in Denmark and Sweden, spouses of patients with cancer experienced increased risk of several psychiatric disorders that required hospital-based specialist care. Our results support the need for clinical awareness to prevent potential mental illness among the spouses of patients with cancer.