I have a bunion where my toes go inward. It can be hereditary. Lots of my family members have them. It’s the way the bones develop over time. 5 months is really young though and it could be a congenital bunion, but I wouldn’t think socks are the reason making her toes inward.
Could you try baby slippers? My girl never liked socks and I don’t want her wearing them all day anyway. She is always feeling things with her feet.
I would ask the pediatrician but I have never heard of this being a thing.
unless the socks were extremely tight i don’t see how that could effect her toe development