Early evidence suggests this “natural immunity” may not last very long, but more studies are needed. It is possible, though rare, that you could be infected again. Plus, it’s important to know that immunity from the vaccine is stronger and more reliable than natural immunity.
Health experts therefore recommend getting vaccinated even if you’ve already had COVID. At this time, we are still learning how long you are protected from getting sick again after recovering from COVID.
https://www.yalemedicine.org/news/how-long-will-coronavirus-vaccine-last (Yale Medicine)