I.
The basic principle is that when a woman bleeds, it is menstrual blood, so long as it does not last for more than fifteen days, in which case it is irregular, non-menstrual bleeding (istihadah).
But if the woman is using contraceptives, she may experience a disruption in her menses, so the characteristics of the blood should be examined in order to determine whether it is menses or irregular bleeding, even if it does not go on for more than fifteen days.
II.
If a woman fasts based on the view that the bleeding is irregular (istihadah), then she realises that it is menstrual bleeding, she must make up the days that she fasted, because the fasts were not valid due to her menses.
It says in Manar as-Sabil (1/218) regarding the conditions of the fast being valid: The conditions of it being valid are six: [the first of which is] being Muslim, because a fast observed by a disbeliever is not valid.
And menstrual or postpartum bleeding (nifas) should have ceased, because of the reasons discussed above in the relevant chapter. End quote.
But if she was relying on the doctor’s opinion, then there is the hope that this is a valid excuse for her, because the view of the doctor carries weight in some cases of disruptions in the menstrual cycle. Moreover, some of the scholars would regard the excuse of ignorance as valid in a case such as this.
Shaykh al-Islam ibn Taymiyah (may Allah have mercy on him) said: Similar to that is the case of the woman who experiences irregular bleeding, if that continues for a while and she does not pray because she believes that she is not obliged to pray. There are two views as to whether she must make up the fasts, one of which says that she does not have to repeat the fasts – as was narrated from Malik and others – because when the woman who was experiencing irregular bleeding said to the Prophet (blessings and peace of Allah be upon him): I bleed continuously and heavily, and that is keeping me from praying and fasting , he told her what to do in the future, and he did not tell her to make up the prayers that she had offered in the past.
End quote from Majmu` al-Fatawa, 21/101.
And Allah knows best.