Praise be to Allah.
Is there a minimum length of nifas in Islam?
The majority of scholars, including the four imams, are of the view that there is no minimum limit for nifas. Whenever a woman becomes pure from nifas, she has to do ghusl and pray and fast, even if that is before forty days have passed since the birth . Because no precise definition has been narrated in the Shari`ah with regard to the minimum length of nifas, so the matter should be based on experience, which shows that nifas may be very short or it may be long. (Ibn Qudamah in al-Mughni, 1/428)
Some of the scholars narrated that there was consensus on this point. Al-Tirmidhi (may Allah have mercy on him) said:
“The scholars among the Companions of the Prophet (peace and blessings of Allah be upon him), the Successors and those who came after them are agreed that a woman in nifas should stop praying for forty days, unless she sees that she has become pure before that, in which case she should do ghusl and pray.” (Al-Majmu’ by al-Nawawi, 2/541)
Can women pray and fast if blood stops before 40 days of nifas?
Shaykh Ibn Baz (15/195) was asked: is it permissible for a woman in nifas to pray, fast and do Hajj before forty days if she becomes pure (i.e., if the bleeding stops)?
“Yes, it is permissible for her to fast, pray and do Hajj and ‘umrah, and it is permissible for her husband to have intercourse with her within forty days , if she becomes pure. If she becomes pure after twenty days, she should do ghusl and pray and fast , and she is permissible for her husband. The report from ‘Uthman ibn Abi’l-As which says that he regarded that as makruh is to be understood as meaning disliked but not forbidden; this is his ijtihad, but there is no evidence for that.
The correct view is that there is nothing wrong with that if the woman becomes pure before forty days. If the bleeding resumes within forty days, then the correct view is that she should regard it as nifas within the 40-day period, but her fasts, prayers and Hajj at the time when she was pure are still valid and she does not have to repeat any of them, so long as they were done when she was pure.”
It says in Fatawa al-Lajnah al-Daimah (5/458):
The Standing Committee (10/155) was asked about a woman who gave birth seven days before Ramadan, then she became pure and fasted Ramadan.
“If the matter is as described and she fasted Ramadan at a time when she was pure, then her fast is valid and she does not have to make it up.”
And Allah knows best