The number of times the Prophet (peace and blessings be upon him) observed fasting in Ramadan
Question
How many months of Ramadan did the Prophet (peace and blessings be upon him) fast?
Answer
Fasting in the month of Ramadan is an obligation upon every sane, adult, capable, and the resident Muslim. The obligation of fasting is firmly established by Quranic texts, the Prophetic Sunnah, and the unanimous consensus of the Muslim Ummah from the time of the Messenger of Allah (peace and blessings be upon him) until present.
Allah Almighty made fasting in the blessed month of Ramadan obligatory for Muslims in the second year of the Hijrah, specifically in the month of Sha’ban. Imam al-Qastalani, in his work Irshad al-Sari Sharh Sahih al-Bukhari, dedicated a chapter titled, “The Obligation of Fasting Ramadan,” stating, "The obligation of fasting the month of Ramadan was established in Sha’ban of the second year after the Hijrah" (3/344).
Imam al-Nawawi, a leading Shafi‘i scholar, confirmed in al-Majmu‘ (6/250), "The Messenger of Allah (peace and blessings be upon him) fasted Ramadan nine times because fasting was made obligatory in Sha’ban of the second year after the Hijrah and he passed away in Rabi‘ al-Awwal of the eleventh year after the Hijrah."
The ruling
Based on the above, the Prophet (peace and blessings be upon him) observed a total of nine months of Ramadan during his lifetime.
And Allah Almighty knows best