Recent studies have revealed increases in population-level cannabis use after legalization of recreational cannabis. However, the association of cannabis legalization with maternal cannabis use during important life stages remains unknown. To investigate the association of legalization of recreational cannabis with maternal cannabis use during the preconception, prenatal, and postpartum periods. This repeated cross-sectional study used state-level data on women who delivered live-born infants in the US from the Pregnancy Risk Assessment Monitoring System from January 2004 to December 2018. Data from 2 states that had legalized recreational cannabis (Alaska and Maine) and 2 states that had not legalized recreational cannabis (New Hampshire and Vermont) were used. Women completed surveys 2 to 6 months after delivery, reporting preconception, prenatal, and postpartum cannabis use. State recreational cannabis legalization. The 3 primary outcomes were self-reported cannabis use during the 12 months before pregnancy (preconception), during pregnancy (prenatal), and the 2 to 6 months after pregnancy (postpartum). A difference-in-differences analysis was used to compare changes in the prevalence of maternal cannabis use during each period before and after state legalization of recreational cannabis, controlling for maternal characteristics (age, race/ethnicity, educational level, income, cigarette smoking, and breastfeeding) and state fixed effects. State-specific survey weights were used. The analytic sample included 23 082 women in the preconception period, 23 859 in the prenatal period, and 26 610 in the postpartum period. In each analysis, most women were married (range among all groups, 63.9%-64.8%), aged 25 to 34 years (preconception, 55.4%; prenatal, 55.9%; postpartum, 56.1%), and had an annual household income less than $50 000 (preconception, 55.7%; prenatal, 56.3%; postpartum, 55.5%). In adjusted analyses, preconception and postpartum cannabis use increased significantly in states that had legalized recreational cannabis compared with states that had not legalized it (preconception risk difference, 0.0457 [95% CI, 0.0013-0.0900]; P = .04; postpartum risk difference, 0.0539 [95% CI, 0.0259-0.0818]; P < .001). The risk difference for prenatal cannabis use was not significant (0.0070; 95% CI, -0.0120 to 0.0260; P = .47). In this repeated cross-sectional study, recreational cannabis legalization was associated with changes in maternal cannabis use before and after pregnancy. The findings suggest that future studies should undertake an interdisciplinary approach to maximize benefit and application of findings to future public health, health care, and policy sectors.