It is decreed that Muslims shall fast the month of Ramadan, unless they are ill or traveling. In Ramadan, the month of the fast, the Messenger used to expend himself to the utmost in worship of all forms - in charity, in reciting the Koran, and in prayers. The last ten days he used to spend in seclusion to be able to give all his time to his Lord. The year he was collected to his Lord he spent the last twenty days in seclusion.
Once in Ramadan his Companions noticed that he ate only after sunset and would not eat again until the same time the next day, so some of them began to do the same, but found it difficult to continue. When the Messenger learnt of what they were doing, he forbade them, saying,
"No, I am not like you, I continue to be fed and given to drink while fasting."
He was most diligent in prayers during Ramadan and encouraged his Companions to be so. He used to pray additional prayers after the evening prayer in the mosque. When the Muslims heard of them, they used to flock towards the mosque in the evening to pray with him.
He feared lest it became custom and many would not be able to maintain these additional prayers after a long day of fasting, so he stopped praying them in the mosque and used to pray them at home. The Muslims, realizing that he did this out of compassion for the old and very young, began to pray these additional prayers in their homes as he did. It is said that at this hour in Medina, the hum of human voices praying was heard emanating from every house.
Apart from Ramadan, he used to fast regularly on unspecified days so as not to make others feel they were obliged to do the same. The lady Aisha says he used to fast for so long that she would think he was never going to break his fast, and then he remained for long periods without fasting. He is known to have fasted three days of every lunar month, the three first days, and also the three days when the moon is full, which are called
"the three white days (the twelfth, thirteenth and fourteenth)."
He also used to fast on Mondays and Thursdays.
He used to say that while the month of Ramadan was obligatory for those who were physically fit, additional days of fasting were entirely optional. Those who cannot fast because of illness in Ramadan may feed a poor man for one day for each day of the fast instead. On days when the Muslims faced heavy tasks he made a point of showing them that he was not fasting.