I just experienced the same issue with my Airpod Pros too. I purchased mine in November of 2019, and they started rattling about 1 month ago.
Apple mentions that some of them manufactured prior to October of 2020 can experience this issue: https://support.apple.com/airpods-pro-service-program-sound-issues
I made an appointment with my local Apple store (appointments only right now), and they confirmed that not all of the headphones manufactured prior to that date that are experiencing this issue are covered.
They look it up based on the serial number and also run it through a diagnostic machine to determine what issues exist.
The link provided by MrBill3 shows it can be $89 per earbud if not covered or $0 if covered.
I thought the only issue with mine was rattling in one earbud only, however it ended up being present in both plus a loss of bass and mid-range sound in both as well. Turns out I was missing out on a lot of sound and there was nothing I could do to fix it (hard reset, un-pair, and re-pair, etc).
Fortunately, both of mine were covered! It's worth having them look at it so you can figure out your options.