Praise be to Allah.
If a woman miscarriages the foetus when human features such as the head and limbs have not yet appeared, and the outlines have not even appeared, the bleeding that occurs with that is irregular vaginal bleeding, and it does not mean that she cannot pray and fast. But if human features have appeared, then this bleeding is nifaas. The earliest that the human features appear is eighty-one days (of pregnancy), as is explained in the answer to question no. 37784 and 45564.
If the matter is as described, that the age of the foetus was two months, then the bleeding that occurred before and after the miscarriage was irregular bleeding, not nifaas. So the woman’s fasting on those days was valid and she does not have to make them up.
And Allaah knows best.