Praise be to Allah.
If a woman miscarries her foetus and human features can clearly be seen in it, then the bleeding she experiences is nifaas. If human features are not clearly seen in it, then it is istihaadah (non-menstrual bleeding), and she may fast and should carry on praying in that case.
Human features can only appear in the mudghah stage, because Allah, may He be glorified, says (interpretation of the meaning):
“O mankind! If you are in doubt about the Resurrection, then verily! We have created you (i.e. Adam) from dust, then from a Nutfah (mixed drops of male and female sexual discharge i.e. offspring of Adam), then from a clot (a piece of thick coagulated blood) then from a little lump of flesh, some formed and some unformed (miscarriage), that We may make (it) clear to you (i.e. to show you Our Power and Ability to do what We will)”
Allah, may He be glorified, describes the mudghah as “formed” or “unformed”.
What is meant by being formed is that there appear in the embryo or foetus signs of the developing body such as the head, limbs, and so on.
This “formation” of the embryo or foetus begins after eighty days, because the Prophet (blessings and peace of Allah be upon him) said: “The creation of any one of you is put together in his mother’s womb for forty days, then he becomes a ‘alaqah (a piece of thick coagulated blood) for a similar period, then he becomes like a chewed piece of flesh (mudghah) for a similar period, then Allaah sends an angel who is enjoined to write down four things, and it is said to him: ‘Write down his deeds, his provision, his lifespan and whether he is doomed for Hell or destined for Paradise. Then the soul is breathed into him.”
Narrated by al-Bukhaari (3208).
This hadeeth indicates that the foetus passes through several stages: forty days as a nutfah (sperm drop), then forty more days as a ‘alaqah (a piece of thick coagulated blood), then a further forty days as a mudghah (chewed piece of flesh). Then the soul is breathed into him after one hundred and twenty days.
So long as the foetus died after sixty-six days of pregnancy, then it was not formed and the bleeding that occurred as a result is istihaadah, not nifaas. So you should not stop praying because of that.
With regard to making up the prayers that you missed on the basis that you thought this bleeding was nifaas, then to be on the safe side you should make up the prayers that you missed. This is the view of the majority of scholars. However some of them are of the view that if a woman does not pray because she did not know and thought that prayer was waived in her case, then she finds out that (the bleeding) is istihaadah, then she does not have to make them up.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
Based on that, if a person does not purify himself as he is obliged to because the text did not reach him, such as if he eats camel meat and does not do wudoo’ after that, then the text reaches him and it becomes clear to him that wudoo’ is required in this case, or he prays in the camel pens, then the text reaches him and the ruling becomes clear to him, does he have to repeat his past prayers? There are two scholarly opinions, both of which were narrated from Ahmad.
A similar case is if he touches his penis then prays, then it becomes clear to him that it is obligatory to do wudoo’ after touching one’s penis.
The correct view in all these cases is that he does not have to repeat the prayers, because Allah pardons things done by mistake or because of forgetting, and because He says (interpretation of the meaning): “And We never punish until We have sent a Messenger (to give warning)” [al-Isra’ 17:15].
If the command of the Messenger (blessings and peace of Allah be upon him) concerning a particular matter did not reach a person, then the ruling that it is obligatory was not proven in his case. Hence in the case of ‘Umar and ‘Ammaar, when they became junub and ‘Umar did not pray whilst ‘Ammaar did pray after rolling in the dust, the Prophet (blessings and peace of Allah be upon him) did not instruct either of them to repeat the prayer. Similarly, he did not instruct Abu Dharr to repeat the prayer when he used to become junub and remained for several days without praying. And he did not instruct the Companion who ate until he could clearly distinguish the white thread from the black thread to make up the fast. And he did not instruct those who prayed facing towards Jerusalem before news reached them that this ruling (of facing Jerusalem when praying) had been abrogated to make up those prayers.
A similar case is that of the woman who was suffering from istihaadah (irregular, non-menstrual bleeding) and did not pray for a while because she thought that prayer was not obligatory in her case. There are two scholarly views as to whether she is obliged to make up the prayers. The first view is that she is not required to do so – as was narrated from Maalik and others – because when the woman who was suffering from istihaadah said to the Prophet (blessings and peace of Allah be upon him): I bleed very heavily and that has kept me from praying and fasting, he told her what she had to do in the future, but he did not instruct her to make up prayers from the past.
End quote from Majmoo‘ al-Fataawa (21/101)
And Allah knows best.