If you got pregnant with an employer’s promise of maternity leave they should be on the hook for all 9 months.
They can either keep you on and get work out of you or they can fire you 2 months in but they’re paying you all 9 months + 3 month maternity leave post partum.