Praise be to Allah.Praise be to Allaah.
The blood that comes out of a woman may be menstruation or nifaas (postpartum bleeding), in which case her fasting is not valid, according to scholarly consensus, because of the report narrated by al-Bukhaari (1951) from Abu Sa’eed (may Allaah be pleased with him) who said: The Prophet (peace and blessings of Allaah be upon him) said: “Is it not the case that when she menstruates, she does not pray or fast?”
Or it may be neither menstruation nor nifaas, such as the blood that comes out because of a haemorrhage in the uterus or because of surgery, etc. This does not mean that a woman cannot pray and fast, rather the woman is taahirah (pure) and may do what women who are pure do, except that she should do wudoo’ for each prayer after the time for it begins.
See also question no. 39494
Hence when the woman who was suffering from istihaadah (non-menstrual vaginal bleeding) asked the Prophet (peace and blessings of Allaah be upon him), “O Messenger of Allaah, I do not become pure, should I stop praying?” the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “That is just a vein and is not menstruation. When the usual time of menstruation comes, stop praying, and when it is over, wash the blood from yourself and pray.” Narrated by al-Bukhaari, 306; Muslim, 333.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) was asked about a woman who had an operation. After the operation and four or five days before her period, she saw dark blood that was not menstrual blood. Then immediately after that her period came and lasted for seven days. Are the days when she bled before her period counted as part of it?
She should refer to doctors concerning this, because it seems that the blood which this woman saw was the result of that operation. Blood that comes because of surgery does not come under the same rulings as menstrual bleeding, because the Prophet (peace and blessings of Allaah be upon him) said concerning the woman who suffered from istihaadah, “That is blood from a vein.” This indicates that if the blood that comes out is from a vein – which includes bleeding because of surgery – then it is not regarded as menstrual blood, so it does not make haraam the things that are made haraam by menses. So she must still pray and fast, if that is during the day in Ramadaan. End quote.
Majmoo’ Fataawa Ibn ‘Uthaymeen, 11/277
The scholars of the Standing Committee for Issuing Fatwas were asked: What is the ruling on one who haemorrhages when he is fasting?
They replied: If a person haemorrhages involuntarily when he is fasting, his fast is valid. End quote.
Fataawa al-Lajnah al-Daa’imah, 10/268.
Based on this, your fast is valid, in sha Allaah.
We ask Allaah to heal all the Muslims who are sick.
And Allaah knows best.