Fasting six days of Shawwaal is dependent upon having completed the Ramadaan fast, according to the correct view. This is indicated by the words of the Prophet (peace and blessings of Allaah be upon him): Whoever fasts Ramadaan then follows it with six days of Shawwaal, it will be as if he fasted a lifetime. Narrated by Muslim, 1164.
The conjunction thumma (then) indicates that this must be done in this order. This indicates that the fast of Ramadaan must be completed first (by observing the Ramadaan fast and making up any missed fasts), then after that one may fast the six days of Shawwaal, so as to attain the reward mentioned in the hadeeth.
The one who still owes missed Ramadaan fasts is said to have fasted part of Ramadaan; we cannot say that he has fasted Ramadaan.
But if a person has an excuse that kept him from fasting the six days of Shawwaal in Shawwaal because he had to make up missed fasts - such as a woman who was bleeding followed childbirth and spent all of Shawwaal making up for Ramadaan - then she may fast six days of Shawwaal in Dhu'l-Qa'dah, because she was excused. Similarly for anyone who has an excuse it is prescribed to make up the six days of Shawwaal in Dhu'l-Qa'dah, after making up the missed Ramadaan fasts. But the one who lets the month of Shawwaal go by without fasting these days and with no excuse, will not attain this reward.
Shaykh Ibn Uthaymeen was asked: What if a woman owes days from Ramadaan - is it permissible for her to give precedence to fasting the six days of Shawwaal over making up the days she owes, or should she give priority to the days she owes over fasting the six days of Shawwaal?
He replied: If a woman still owes days from Ramadaan, then she should not fast the six days of Shawwaal until after she has made up what she owes, because the Prophet (peace and blessings of Allaah be upon him) said: Whoever fasts Ramadaan then follows it with six days of Shawwaalâ€¦ Whoever still has days to make up from Ramadaan has not fasted Ramadaan, so she will not attain the reward of fasting the six days of Shawwaal until after she has finished making up the days she owes. If we assume that this making up missed fasts lasts throughout Shawwaal, such as if a woman was bleeding following childbirth and did not fast at all in Ramadaan, then she started to make up her missed fasts in Shawaal and did not finish that until Dhu'l-Qa'dah began, then she may fast the six days, and she will have the reward of one who fasted them in Shawwaal, because she delayed it for a necessary reason, so she will have the reward.
Majmoo' al-Fataawa, 20/19. See also questions no. 4082 and 7863.
In addition to that, it is obligatory to make up missed fasts for the one who had an excuse, indeed that is part of this pillar of Islam. Based on this, hastening to do it and to discharge this duty takes priority over doing actions that are mustahabb. See question no. 23429.
Reproduced from Islam QA