Praise be to Allah.
If a woman miscarries, the bleeding that follows is not regarded as nifaas (post partum bleeding) unless the miscarried foetus had developed human features such as a head, hand, foot and so on.
The blood that she passes is not considered to be nifaas unless the foetus had human features.
Human features do not appear in the foetus before eighty days of pregnancy, because the Prophet (peace and blessings of Allaah 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 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 a human being goes through a number of stages during pregnancy.
For forty days he is a nutfah (mixed drops of male and female sexual discharge, for the next forty days he is a ‘alaqah (a piece of thick coagulated blood), then for forty days he is a mudghah (a lump of chewed flesh), then the soul is breathed into him after one hundred and twenty days have passed.
Human features begin to appear at the mudghah stage, not before that, because Allaah 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. the 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 (as in the case of miscarriage) — that We may make (it) clear to you (i.e. to show you Our Power and Ability to do what We will)”
From this verse it is known that the mudghah may or may not have human features.
Ibn Qudaamah (may Allaah have mercy on him) said: If a woman sees blood after passing something in which there were human features, then it is nifaas. This was stated by Imam Ahmad. But if she sees that [bleeding] after passing a nutfah or ‘alaqah, then it is not nifaas. End quote from al-Mughni, 1/211.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on him) said: If a woman miscarries something in which human features are visible, such as a head, hand, foot and so on, then she is in nifaas, and comes under the rulings on nifaas, so she should not pray or fast and it is not permissible for her husband to have intercourse with her until she becomes pure or until forty days have passed.
But if there are no discernible human features in that which is passed by the woman, and it is like a piece of meat with no features, or it is blood, then that comes under the rulings on istihaadah (non-menstrual vaginal bleeding) and not the rulings on menstruation, and she has to pray and fast in Ramadan, and she is permissible to her husband, because she comes under the rulings on istihaadah according to the scholars. End quote from Fataawa Islamiyyah, 1/243.
Shaykh Ibn ‘Uthaymeen said:
The scholars said: If something is passed in which human features appear, then the blood which is passed after it emerges is regarded as nifaas, during which the woman should not pray or fast and her husband should avoid intimate relations with her until she becomes pure. But if what is passed is not formed, then the bleeding is not regarded as nifaas, rather it is irregular bleeding which does not prevent the woman from praying or fasting or anything else.
The scholars said: The minimum time in which human features may appear is 81 days.
Fataawa al-Mar’ah al-Islamiyyah, 1/304, 305
Based on that, the bleeding which you experienced was not nifaas, because the foetus was miscarried before the completion of 80 days, and you should have prayed and fasted during that period, unless your menses came to you.
You have to make up the fasts, and there is no confusion on this issue, regardless of whether we say that you were pure or in nifaas, because the one who does not fast for a reason (such as sickness or menses or travelling) is obliged to make up the fast. You did not fast for a reason, which is that you thought you were in nifaas.
As for making up the prayers, it seems that you are not obliged to make them up, because the Prophet (blessings and peace of Allah be upon him) did not tell the woman who was suffering istihaadah and did not pray during the time she was bleeding to make the prayers, rather he advised her as to what she should do in the future.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: If the woman who is suffering istihaadah did not pray for a while because she believed that prayer was not obligatory for her, then there are two opinions as to whether it is obligatory for her to make up the prayers or not. The first view is that she does not have to make them up, as was narrated from Maalik and others, because when the woman who was suffering istihaadah said to the Prophet (blessings and peace of Allah be upon him): “I experience severe and painful bleeding that prevents me from praying and fasting,” he told her what she should do in the future but he did not tell her to make up the past prayers. End quote from Majmoo’ al-Fataawa (22/102). See also the answer to question number 45648.
To sum up:
You have to make up the fasts. As for the prayers, if it is easy to you to make them up, then do that. Otherwise we hope that Allah will pardon you for that. And we advise you to strive to seek knowledge and understanding of your deen.
We ask Allah to help and guide us and you.
And Allah knows best.