Importance Peripartum suicide attempt is a major psychiatric complication associated with pregnancy, but the risk factors remain largely uncertain. Objective To identify the demographic characteristics and predisposing risks for peripartum suicide attempts and postpartum depression. Design, Setting, and Participants This cohort study used retrospective data on pregnant women who delivered children between April 1, 2016, and March 31, 2021, at 712 hospitals in Japan. The nationwide Diagnosis Procedure Combination database was used. Exposures Psychiatric and nonpsychiatric medical history, age, alcohol and tobacco use, and obstetric complications and procedures. Main Outcomes and Measures Data on admissions for prepartum suicide attempt and delivery during the same hospital stay and readmissions for depression or suicide attempt within 1 year post partum were collected. Comparisons of prevalence of each study variable were performed, and multivariable logistic regression analyses were used to determine risk factors. Results From a total of 39 908 649 hospitalization episodes, 804 617 cumulative pregnant women (median [IQR] age at childbirth, 33 [29-36] years) who delivered at the enrolled hospitals were identified, including 1202 who were admitted for suicide attempt and delivery during the same hospital stay and 111 readmitted for suicide attempt within 1 year post partum. Risk factors associated with prepartum suicide attempts included younger age (adjusted odds ratio [aOR], 0.99; 95% CI, 0.98-1.00) and histories of personality disorder (aOR, 10.81; 95% CI, 5.70-20.49), depression (aOR, 3.97; 95% CI, 2.35-6.70), schizophrenia (aOR, 2.89; 95% CI, 1.52-5.50), and adjustment disorder (aOR, 2.66; 95% CI, 1.07-6.58). Risk factors associated with postpartum suicide attempts included younger age (aOR, 0.96; 95% CI, 0.93-1.00), heavy tobacco use (aOR, 23.09; 95% CI, 5.46-97.62), and histories of alcohol use disorder (aOR, 163.54; 95% CI, 28.30-944.95), personality disorder (aOR, 10.28; 95% CI, 3.29-32.10), anxiety disorders (aOR, 8.13; 95% CI, 2.88-22.98), depression (aOR, 7.27; 95% CI, 2.95-17.91), schizophrenia (aOR, 5.77; 95% CI, 2.17-15.38), bipolar disorder (aOR, 3.98; 95% CI, 1.36-11.67), and insomnia (aOR, 3.17; 95% CI, 1.30-7.78). On sensitivity analysis, risk factors associated with postpartum depression after excluding those with prenatal depression included histories of personality disorder, adjustment disorder, bipolar disorder, insomnia, and anxiety disorders. Conclusions and Relevance The findings of this cohort study suggest that histories of smoking and prenatal psychiatric disorders are potential risk factors for peripartum suicide attempts and may require additional treatment and prevention interventions.