BackgroundSelf-harm in pregnancy or the year after birth (‘perinatal self-harm’) is clinically important, yet prevalence rates, temporal trends and risk factors are unclear.MethodsA cohort study of 679 881 mothers (1 172 191 pregnancies) was conducted using Danish population register data-linkage. Hospital treatment for self-harm during pregnancy and the postnatal period (12 months after live delivery) were primary outcomes. Prevalence rates 1997–2015, in women with and without psychiatric history, were calculated. Cox regression was used to identify risk factors.ResultsPrevalence rates of self-harm were, in pregnancy, 32.2 (95% CI 28.9–35.4)/100 000 deliveries and, postnatally, 63.3 (95% CI 58.8–67.9)/100 000 deliveries. Prevalence rates of perinatal self-harm in women without a psychiatric history remained stable but declined among women with a psychiatric history. Risk factors for perinatal self-harm: younger age, non-Danish birth, prior self-harm, psychiatric history and parental psychiatric history. Additional risk factors for postnatal self-harm: multiparity and preterm birth. Of psychiatric conditions, personality disorder was most strongly associated with pregnancy self-harm (aHR 3.15, 95% CI 1.68–5.89); psychosis was most strongly associated with postnatal self-harm (aHR 6.36, 95% CI 4.30–9.41). For psychiatric disorders, aHRs were higher postnatally, particularly for psychotic and mood disorders.ConclusionsPerinatal self-harm is more common in women with pre-existing psychiatric history and declined between 1997 and 2015, although not among women without pre-existing history. Our results suggest it may be a consequence of adversity and psychopathology, so preventative intervention research should consider both social and psychological determinants among women with and without psychiatric history.