Working while pregnant.. discrimination?

Lexi

Hey guys so I was just told by my hr that the company fires there pregnant employees before they go on maternity leave because if you haven’t been there for 1 year you do not qualify.... is this illegal ? Pretty upsetting and I wasn’t aware when I was hired on no signed documents regarding this .