Cannabis use is increasingly common among pregnant individuals and might be a risk factor for severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) infection. We aimed to test whether prenatal cannabis use is associated with increased risk of SARS-CoV-2 infection during pregnancy. This is a retrospective cohort study. The study was conducted in California, USA. A total of 58?114 pregnancies (with outcomes from 5 March 2020 to 30 September 2021) among 57?287 unique pregnant women aged 14-54?years who were screened for prenatal substance use, enrolled in Kaiser Permanente Northern California (KPNC) (a health-care system) and had not tested positive for COVID-19 prior to pregnancy onset. We utilized data from the KPNC electronic health record. Cannabis use status (current, recently quit and non-user) was based on universal screenings during prenatal care (including urine toxicology testing and self-reported use on a self-administered questionnaire). SARS-CoV-2 infection [based on polymerase chain reaction (PCR) tests] was estimated in time-to-event analyses using Cox proportional hazard regression models adjusting for covariates. Secondary analyses examined differences in (a) SARS-CoV-2 testing rates and (b) SARS-CoV-2 infection rates among those tested. We observed 348?810 person-months of follow-up time in our cohort with 41?064 SARS-CoV-2 PCR tests and 6% (n?=?2414) of tests being positive. At the start of follow-up, 7% of pregnant individuals had current use, 12% had recently quit and 81% did not use cannabis. Adjusting for covariates, current use was associated with lower rates of SARS-CoV-2 infection [adjusted hazard ratio (aHR)?=?0.60, 95% confidence interval (CI)?=?0.49-0.74 than non-use. Those who had recently quit did not differ from non-cannabis users in infection rates (aHR?=?0.96, 95% CI?=?0.86-1.08). Sensitivity analyses among patients who received a SARS-CoV-2 test also found lower odds of infection associated with current versus no cannabis use (aOR?=?0.76, CI?=?0.61-0.93). Current cannabis use appears to be associated with a reduced risk of SARS-CoV-2 infection among pregnant individuals.