In the US if you have an approved FMLA qualifying condition, you cannot be fired for missing work because of the condition. But your company has to offer it and you have to provide the documentation. If they said you were fired because you were pregnant that's a problem. If they said you were fired for absences, they can do that unless you have FMLA. Employers can fire at will employees without cause.