BACKGROUND: Data assessing protection conferred from COVID-19 mRNA vaccination and/or prior SARS-CoV-2 infection during Delta and Omicron predominance periods in the United States are limited. METHODS: This cohort study included persons ≥18 years who had ≥1 health care encounter across 4 health systems and had been tested for SARS-CoV-2 before 26 August 2021. COVID-19 mRNA vaccination and prior SARS-CoV-2 infection defined the exposure. Cox regression estimated hazard ratios (HRs) for the Delta and Omicron periods; protection was calculated as (1-HR)×100%. RESULTS: Compared to unvaccinated and previously uninfected persons, during Delta predominance, protection against COVID-19-associated hospitalizations was high for those 2- or 3-dose vaccinated and previously infected, 3-dose vaccinated alone, and prior infection alone (range, 91%-97%, with overlapping 95% confidence intervals [CIs]); during Omicron predominance, estimates were lower (range, 77%-90%). Protection against COVID-19-associated emergency department/urgent care (ED/UC) encounters during Delta predominance was high for those exposure groups (range, 86%-93%); during Omicron predominance, protection remained high for those 3-dose vaccinated with or without a prior infection (76%; 95% CI = 67%-83% and 71%; 95% CI = 67%-73%, respectively). CONCLUSIONS: COVID-19 mRNA vaccination and/or prior SARS-CoV-2 infection provided protection against COVID-19-associated hospitalizations and ED/UC encounters regardless of variant. Staying up-to-date with COVID-19 vaccination still provides protection against severe COVID-19 disease, regardless of prior infection.