This cohort study compares the mortality and hospitalization risks among patients with vs without solid cancer and diagnosed with COVID-19 during the period when the Omicron variant was dominant.