If the woman who is bleeding in nifaas becomes pure (i.e., the bleeding stops) within forty days and she fasts for a few days, then the bleeding comes back within forty days, then her fast is valid, but she has to stop praying and fasting during the days on which the bleeding comes back – because it is (still) nifaas – until she becomes pure or the forty days end. When forty days have ended, she has to do ghusl, even if she has not seen the tuhr (white discharge signalling the end of menses or nifaas), because forty days marks the end of nifaas according to the more sound of the two scholarly opinions. After that, she has to do wudoo’ at the time of every prayer, until the bleeding stops, as the Prophet (peace and blessings of Allaah be upon him) instructed the woman who was suffering from istihaadah (non-menstrual vaginal bleeding). And her husband may be intimate with her after forty days, even if she has not seen the tuhr, because the bleeding in this case is irregular bleeding which does not prevent her from praying and fasting, and does not prevent her husband from being intimate with his wife.
But if the bleeding after forty days coincides with the usual time of her menses, then she should stop praying and fasting and regard it as menses. And Allaah is the Source of Strength. End quote.