In the month of Shaban in this year, fasting in Ramadan became an obligation [The Beginning and the End]. Fasting is a spiritual form of worship whose obligation came gradually, in steps, as happened with other forms of worship. With regard to worship, the cirumstances of those who the Islamic legislation addresses are taken into consideration.
When the Messenger (peace be upon him) first entered Medinah, he used to fast 3 days every month. The Messenger (peace be upon him) then learnt that the Jews fasted the 10th of Muharrem, and when he asked about this he (peace be upon him) was told, “This is the day Allah saved Moses (from Pharoah).” Therefore, the Messenger (peace be upon him) replied, <We have more right to (celebrate the events of) Moses than you,> so he fasted the 10th of Muharrem and ordered his Companions to fast it as well [related by Ibn Majah] [The Beginning and the End].
Muadh ibn Jabal (may Allah be pleased with him) related the gradual steps of the obligation of fasting, saying, “When the Messenger (peace be upon him) entered Medinah, he used to fast 3 days every month and the 10th of Muharrem. Then Allah (Glory be to Him) revealed the obligation of the yearly fast, {Believers! Fasting is enjoined upon you, as it was enjoined upon those before you} [Surah Al-Baqarah: 183] to {For those who are capable of fasting (but still do not fast) there is a redemption: feeding a needy man for each day missed} [Surah Al-Baqarah: 184].
Those who wanted to fast used to fast; and those who wanted to feed a poor person instead of fasting, could do so.
Then Allah (Glory be to Him) revealed the final ayah about this, {During the month of Ramadan, the Qur'an was sent down} [Surah Al-Baqarah: 185], to His saying, {So those of you who live to see that month should fast it} [Surah Al-Baqarah: 185]. Therefore, fasting became an obligation on a healthy person resident in any place. However, an ill person or a traveller was allowed to delay the fast and the elderly who were not able to fast could feed a poor person instead for each day he did not fast. These were the two possible cases for fasting.
Muadh continued, “We used to eat, drink, and approach our wives (after sunset) until we slept, but after we had slept, we refrained from all this.”
But one time, one of the Ansar (Helpers from Medinah) called Sirmah fasted until evening, and after he returned to his family he prayed and slept until morning without eating or drinking anything. When he was fasting the following day, the Messenger (peace be upon him) noticed that he was in great difficulty and asked, <‘Why do I see that you are in great difficulty?’ Consequently, he told the Messenger (peace be upon him) what had happened. The reporter then explained that Omar went to his wife after sleeping when fasting. Therefore, he went to the the Messenger (peace be upon him) and mentioned this to him. As a result, Allah (Glory be to Him) revealed, {It has been made lawful for you to go to your wives during the night of the fast. They are your garment} [Surah Al-Baqarah: 187] to, {then (give up all that and) complete your fasting until night sets in} [Surah Al-Baqarah: 187]> [related by Ahmed].