I am so old, I remember when The Expertstm said natural immunity did not exist (which never made any sense):

Three years into the pandemic, the immune systems of the vast majority of humans have learnt to recognize SARS-CoV-2 through vaccination, infection or, in many cases, both.

….

In one study1, researchers looking at Portugal’s national database of infections studied vaccinated people who became infected during the BA.1/BA.2 wave. Analysis showed that 90 days after an infection, this population had high immune protection — their risk of becoming infected with BA.5 was just one-sixteenth that of people who had been vaccinated but never infected. After that, hybrid immunity against infection declined steeply for a few months and then stabilized, ultimately providing protection for eight months after infection, the duration of the study.

….

What about those who haven’t been vaccinated? Another study in Qatar suggests that if the virus doesn’t change, infection-based immunity against reinfection can last up to three years.

Source: How quickly does COVID immunity fade? What scientists know