All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu 'alyhi wa sallam, is His slave and Messenger.
Shaykh Ibn ‘Uthaymeen said: "If menstrual blood emerges while a woman is fasting, it invalidates her fast. The Prophet, , once asked (rhetorically about such a case): “…Does she not abandon prayer and fasting when she has menstruation...?” This is why we consider menstruation as one of the matters that invalidates fasting, and post-partum bleeding takes the same ruling. If a pregnant woman discharges blood while fasting in the month of Ramadan she should determine whether or not this blood is menstruation. If it is menstruation, it will invalidate her fasting, but if it is not menstruation her fasting will be valid. For some pregnant women (and this is very rare), menstruation is the regular blood that has not stopped since the beginning of her pregnancy and which comes at the regular time during which she would have menstruation. This is considered menstruation according to the preponderant opinion and it takes the same rulings as menstruation does. However, if her menstruation stops after she gets pregnant and then she starts to see blood that is different from the usual menstrual blood, this does not affect her fasting as it is not menstruation."
Allaah Knows best.