If a menstruating woman becomes pure after the time for ‘Isha’ begins, then she has to pray ‘Isha’ because she was pure during that time. She also has to pray Maghrib because it may be joined to ‘Isha’ if there is an excuse.
Similarly, if she becomes pure after the time for ‘Asr begins, she has to pray Zuhr and ‘Asr. This is what was stated in fatwas by some of the companions of the Prophet (peace and blessings of Allaah be upon him), and it is the view of the majority of scholars.
But if she becomes pure after the time for Fajr, Zuhr or Maghrib begins, she only has to offer one prayer, namely the prayer at the time of which she became pure (Fajr or Zuhr or Maghrib), because these prayers cannot be joined to anything that comes before them.
Ibn Qudaamah (may Allaah have mercy on him) said in al-Mughni (1/238): If the menstruating woman becomes pure before the sun sets, she should pray Zuhr then ‘Asr.
If she becomes pure before dawn breaks, she should pray Maghrib and ‘Isha’. This opinion was narrated from ‘Abd al-Rahmaan ibn ‘Awf, Ibn ‘Abbaas, Tawoos, Mujaahid, al-Nakha’i, al-Zuhri, Rabee’ah, Maalik, al-Layth, al-Shaafa’i, Ishaaq and Abu Thawr. Imam Ahmad said: Most of the Taabi’een were of this view, except al-Hasan who said that she only has to offer the prayer at the time of which she became pure. This was the view of al-Thawri and ashaab al-ra’y.
Ibn al-Mundhir narrated that ‘Abd al-Rahmaan ibn ‘Awf and ‘Abd-Allaah ibn ‘Abbaas thought that the menstruating woman who becomes pure one-rak’ah before dawn should pray Maghrib and ‘Isha’, and if she becomes pure before the sun sets, she should pray Zuhr and ‘Asr together.
Because the time for the second prayer is the time for the first at the time when the excuse is applicable, so when the one who had an excuse no longer has an excuse, then he must offer the obligatory prayer, and he must offer the obligatory prayer for the second prayer too.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) favoured the view that she only has to offer the prayer the time of which she caught up with, and she does not have to join to it the prayer that came before it.
In order to be on the safe side, you should follow the view of the majority of scholars and offer the two prayers together. But if a woman offers only the prayer the time of which she caught up with, we hope that there is no sin on her. If a woman did not do that in the past because she was unaware of the ruling, she does not have to do anything, because of the general meaning of the evidence that the one who is ignorant and the one who makes a mistake are excused, and because the issue is one where there is a difference of scholarly opinion, as stated above.
See also the answer to question no. 45648.
And Allaah knows best.