PurposeTo determine the impact of abortion legislation on mental health during pregnancy and postpartum and assess whether pregnancy intention mediates associations. MethodsWe quantified associations between restrictive abortion laws and stress, depression symptoms during and after pregnancy, and depression diagnoses after pregnancy using longitudinal data from Nurses’ Health Study 3 in 2010–2017 (4091 participants, 4988 pregnancies) using structural equation models with repeated measures, controlling for sociodemographics, prior depression, state economic and sociopolitical measures (unemployment rate, gender wage gap, Gini index, percentage of state legislatures who are women, Democratic governor). ResultsRestrictive abortion legislation was associated with unintended pregnancies (β = 0.127, p = 0.02). These were, in turn, associated with increased risks of stress and depression symptoms during pregnancy (total indirect effects β = 0.035, p = 0.03; β = 0.029, p = 0.03, respectively, corresponding <1% increase in probability), but not after pregnancy. ConclusionsAbortion restrictions are associated with higher proportions of unintended pregnancies, which are associated with increased risks of stress and depression during pregnancy.