When Can You Pray After a Miscarriage?
Question

If a woman has a miscarriage and has discharge of blood, does she pray?
Praise be to Allah.This case depends on the type of blood. Is the blood what is known as post-natal bleeding (nifas) or vaginal bleeding (istihadah ) (but not part of her regular period)? 
The scholars have declared the regulation in this matter. They said: 
"If she sees the blood after the abortion of a formed human being, then it is nifas; if she sees blood after the abortion of a clot, then it is not nifas." (Al-Mughni ma' al-Sharh al-Kabir 1/361) 
In the latter case, she is considered to be mustahada, so she performs wudu for every prayer when the time for it is due and she prays. 
Whereas if the aborted object is a fetus or has human-formed organs like an arm or a leg or a head, then it is considered nifas. 
For the case where the aborted object is disposed of in the hospital before the woman saw it, the scholars have mentioned that the least amount of time human form starts to take place is eighty one days after pregnancy.  (Majmu’ Fatawa Ibn ‘Uthaymin 4/292)
This is based on the report of ‘Abdullah Bin Mas’ud's hadith (may Allah be pleased with him), in which he said that the Prophet (peace and blessings be upon him) spoke to us, and he is the truthful and believed one, and said: "Each one of you, human creation, forms in his mother's womb for forty days, then he is a hanging clot for the same amount of time, then he is a mudghah (the size of a morsel) for the same amount of time, then Allah sends an angel who is commanded with four things: he is told to write his deeds, his livelihood and sustenance, whether he is happy or distressed " (Sahih al-Buhari 6/303)
Ladies in this case should spend the effort to find out from the doctors' estimations until her situation is clear to her.
As for the blood that is discharged just prior to a normal delivery, if it is accompanied with the pains of contraction, then it is nifas, and if not, then it is not. Shaykh al-Islam Ibn Taimiyyah (may the mercy of Allah be upon him) said: "What she sees when the contractions commence is nifas. What is referred to here is contractions after which follows delivery; otherwise it is not nifas." (Majmu’ Fatawa Ibn ‘Uthaymin 4/327)
Reference: “What Should You Do in the Following Situations by Sheikh Muhammad Salih Al-Munajjid.