Why do doctors ask for SSN?

I never give my SS when I’m at the doctors but today the gyn I saw asked for ss and i don’t know why I gave it to her 🤦🏽‍♀️ now I’m all paranoid and freaking out! Can they steal my identity?