There is a dispute amongst the religious scholars regarding the longest period of nifaas (the post-natal bleeding period). Some scholars say it is forty (40) days, others say it is sixty (60) days and some say there is no limit to the maximum number of days a woman can be a in a state of nifaas. The most predominate opinion is that the maximum period is forty (40) days according to what is narrated by Umm Salama. Umm Salama said "The nufasaa' (a woman in a state of birth blood discharge) used to continue to be in childbed for forty days at the time of the Prophet peace and blessings be upon him."
Al-Tirmidhi reported: "It is unanimously agreed upon among religious scholars from the sahaabah (companions of the Prophet , peace and blessings be upon him) and al-taabi'oon (those who had met only a companion of the Prophet , but not the Prophet himself) that the nufasaa' does not pray for forty days unless she sees tuhr (blood stoppage) before the end of the forty days period. She should then perform ghusl (ablution of the whole body) and she resumes praying. The majority of the religious scholars say that a woman does pray even If she continues to notice blood after the forty days period expires and this is the opinion of the majority of fuqahaa' (religious scholars) among whom Sufian Al-Thawry, Ibn Al-Mubarak, Al-Shafi'i, Ahmad and Ishaaq." Sunan Al-Tirmidhi hadeeth # 139.
The same hadeeth is also reported by Imam Ahmad, Abu Dawood, Ibn Majah and Al-Daraami and is classified as hasan by Al-Albaani in Irwaa' Al-Ghaleel # 201. Al-Albaani has supported this narration by another hadeeth reported by Abu Dawood narrated by Umm Salama who said, "A Prophet's (peace and blessings be upon him) wife used to remain in (a state of) nifaas for forty nights and the Prophet would not ask her to make up the prayers she missed during the period of nifaas".
Ibn Majah also reported that Anas, may Allaah be pleased with him, narrated that "The Prophet had specified a period of forty days for the nufasaa' unless she achieves tuhr before that." Irwaa' Al Ghaleel # 223-222/1.
Therefore, if a woman experiencing post-childbirth bleeding spent forty days and she still sees blood, then we consider this blood as istihaadha (womb bleeding between periods) which does not stop a woman from performing prayer (salaat) nor fasting (siyaam), unless the end of the forty days coincides with the regular menstrual period (dawrah); in this case she would consider this blood as menstrual blood.
Allaah knows best.