As someone who has experienced mastitis my self, let me tell you this. If you can touch it, she is fine. Trust me lol.
In terms of if she can get it before foaling, well that depends on if her milk is running or not. Mastitis is a blockage of a milk duct that causes the milk to burst out into the surrounding tissue. So while your mare is starting to produce milk, until it starts needing to go anywhere, I don't think she can get it.
The best treatment for mastitis, btw, is to express it out lol. Once again, trust me when I say the relief is immediate