Wa`alaykum as-salamu wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear sister, let us express our sincere thanks to you for your eagerness to ask this question and we implore Almighty Allah to guide us all to His straight path!
First, we console you and hope that Almighty Allah compensates you for this ordeal and grants you a righteous child. You have to know that this ordeal is a trail from Almighty Allah to test your faith and patience.
The blood that is discharged after a miscarriage depends upon the status of the fetus. If the fetus was not shaped or the soul had not yet been breathed into it, then this blood is not considered nifas and thus, you have to wash it off, perform wudu’ (ablution) and pray.
However, if the fetus was shaped or the soul was breathed into it, whether it was miscarried dead or alive, this blood is considered nifas and you should not pray till it stops. The creation and formation of the fetus, i.e., the appearance of human features, becomes apparent after eighty days after conception, as stated in the following hadith:
The Prophet (peace and blessings 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 for a similar period, then Allah 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.” (Al-Bukhari)
In his response to your question, Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
If your bleeding was not due to menses but it was due to miscarriage at such an early stage, then you should perform salah; you simply need to wash yourself and perform wudu’ and pray. It should only be treated as nifas (postnatal bleeding) if it is preceded by birth. Since it was not due to birth, you can assume that it is not nifas.
However, if the fetus has evolved and is fully formed then it should be treated as bleeding due to nifas.
Allah Almighty knows best.