The pregnant woman is not prevented from praying and entering the mosque
Praise be to Allah
With regard to a woman who is pregnant, Islamic teaching does not forbid her to pray or enter the mosque. So she is obliged to offer the five daily prayers, and she may offer whatever supererogatory prayers she wants. It is permissible for her to enter the mosque to pray or to attend lessons and lectures and beneficial gatherings, so long as she adheres to the conditions set out in Islamic teaching for a Muslim woman to go out to the mosque, which have been explained previously in fatwa no. 49898.
There are Islamic rulings which Allah, may He be exalted, has prescribed for the pregnant woman, that are appropriate to her situation. We will mention some of these rulings here. They include the following:
It is permissible for a pregnant woman to break the fast in Ramadan if fasting is too difficult for her. The ruling may reach the degree of it being prohibited for her to fast if doing so will harm the foetus.
It says in al-Mawsoo‘ah al-Fiqhiyyah (16/271):
It is permissible for the pregnant woman to break the fast if she fears or thinks it most likely that she or her child will be harmed, and she must break the fast if she fears that she may die or be greatly harmed, and she has to make up the fasts, without paying any fidyah (penalty). This is according to the consensus of the fuqaha’ (jurists). They are also unanimously agreed that a pregnant woman does not have to pay the fidyah if she breaks the fast for fear of harm to herself, because she is in the same situation as a sick person who fears harm to himself. End quote.
And Allah knows best.