Importance Major depressive disorder (MDD) is an important risk factor of suicidal behavior, but the added burden of suicidal behavior and MDD on the patient and societal level, including all-cause mortality, is not well studied. Also, the contribution of various prognostic factors for suicidal behavior has not been quantified in larger samples. Objective To describe the clinical and societal outcomes, including all-cause mortality, of suicidal behavior in patients with MDD and to explore associated risk factors and clinical management to inform future research and guidelines. Design, Setting, and Participants This population-based cohort study used health care data from the Stockholm MDD Cohort. Patients aged 18 years or older with episodes of MDD diagnosed between January 1, 2012, and December 31, 2017, in any health care setting were included. The dates of the data analysis were February 1 to November 1, 2022. Exposures Patients with MDD with and without records of suicidal behavior. Main Outcomes and Measures The main outcome was all-cause mortality. Secondary outcomes were comorbid conditions, medications, health care resource utilization (HCRU), and work loss. Using Region Stockholm registry variables, a risk score for factors associated with suicidal behavior within 1 year after the start of an MDD episode was calculated. Results A total of 158 169 unipolar MDD episodes were identified in 145 577 patients; 2240 (1.4%) of these episodes, in 2219 patients, included records of suicidal behavior (mean [SD] patient age, 40.9 [18.6] years; 1415 episodes [63.2%] in women and 825 [36.8%] in men). A total of 11 109 MDD episodes in 9574 matched patients with MDD without records of suicidal behavior were included as controls (mean [SD] patient age, 40.8 [18.5] years; 7046 episodes [63.4%] in women and 4063 [36.6%] in men). The all-cause mortality rate was 2.5 per 100 person-years at risk for the MDD-SB group and 1.0 per 100 person-years at risk for the MDD-non-SB group, based on 466 deaths. Suicidal behavior was associated with higher all-cause mortality (hazard ratio, 2.62 [95% CI, 2.15-3.20]), as well as with HCRU and work loss, compared with the matched controls. Patients with MDD and suicidal behavior were younger and more prone to have psychiatric comorbid conditions, such as personality disorders, substance use, and anxiety, at the start of their episode. The most important factors associated with suicidal behavior within 1 year after the start of an MDD episode were history of suicidal behavior and age, history of substance use and sleep disorders, and care setting in which MDD was diagnosed. Conclusions and Relevance This cohort study’s findings suggest that high mortality, morbidity, HCRU, and work loss associated with MDD may be substantially accentuated in patients with MDD and suicidal behavior. Use of medication aimed at decreasing the risk of all-cause mortality during MDD episodes should be systematically evaluated to improve long-term outcomes.