The Prophet ﷺ underwent four transitions with regards to the fasting of ‘Āshūrā’
The First State
He used to fast it in Makkah but he did not command the people to fast.
There is a narration in the Ṣaḥīḥayn on the authority of ‘Ā’ishah
رضي الله عنها who said:
عن عائشة رضي الله عنها قالت: كان عاشوراء يوما تصومه قريش في الجاهلية وكان النبي صلى الله عليه وسلم يصومه فلما قدم المدينة صامه وأمر بصيامه فلما نزلت فريضة شهر رمضان كان رمضان هو الذي يصومه فترك يوم عاشوراء فمن شاء صامه ومن شاء أفطره
The Day of ‘Āshūrā’ was a day that the Quraysh used to fast during the times of al-Jāhiliyyah and the Prophet ﷺ also used to fast it. Then when he came to al-Madinah he fasted it and he commanded its fasting. Then when the obligation of fasting the month of Ramaḍān was revealed, it was Ramaḍān that he fasted and thus he left off the Day of ‘Āshūrā’ , so whoever wished could fast it and whoever wished did not have to fast it.Reported by Al-Bukhārī 2002 and Muslim 1125
وفي رواية للبخاري وقال رسول الله صلى الله عليه وسلم: “من شاء فليصمه ومن شاء أفطر”.
And in the narration of al-Bukhārī,
“And the Prophet ﷺ said, ‘Whoever wishes then let him fast and whoever wishes then do not fast.’”
The Second State
The Prophet ﷺ came to al-Madinah and he saw the Ahl al-Kitāb fasting it and holding it in high regard – and he was pleased with his having been in accord with them in the fast which he had not previously ordered the people to do. So he then commanded the people to fast that day and emphasized the command to fast it. He encouraged the people to do so to the extent that even the children would fast it.
It has been reported in the Ṣaḥīḥayn on the authority of Ibn ‘Abbās who said:
عن ابن عباس قال: قدم رسول الله صلى الله عليه وسلم المدينة فوجد اليهود صياما يوم عاشوراء فقال لهم رسول الله صلى الله عليه وسلم: ما هذا اليوم الذي تصومونه؟ قالوا: هذا يوم عظيم أنجى الله فيه موسى وقومه وأغرق فرعون وقومه فصامه موسى شكرا فنحن نصومه فقال رسول الله صلى الله عليه وسلم: “فنحن أحق وأولى بموسى منكم” فصامه رسول الله صلى الله عليه وسلم وأمر بصيامه.
The Messenger of Allah ﷺ came to al-Madinah and then he found the Jews fasting the day of ‘Āshūrā’, so he said, “What is this day which you are fasting?” They replied, “This is a great day on which Allah saved Mūsā and his people and drowned Fir’awn and his people, so Mūsā fasted it out of gratitude to Allah and so we fast it.” The Messenger of Allah ﷺ said, “We have more right and are closer to Mūsā than you”, so the Messenger of Allah ﷺ fasted it and ordered its fasting.Reported by Al-Bukhārī 2004 and Muslim 1130
عن سلمة بن الأكوع رضي الله عنه أن النبي صلى الله عليه وسلم أمر رجلا من أسلم: أن أذن في الناس: من أكل فليصم بقية يومه ومن لم يكن أكل فليصم فإن اليوم يوم عاشوراء
And in the Ṣaḥīḥayn on the authority of Salamah bin al-Akwa’ there is a report that the Prophet ﷺ commanded two men from the tribe of Aslam to announce to the people, “Whoever has eaten, then let him fast the rest of the day, and whoever has not eaten, then let him fast, for this day is the Day of ‘Āshūrā’.”Reported by Al-Bukhārī 1924 and Muslim 1135
And there are an abundance of aḥādīth on this subject.
The Third State
When the fasting of the month of Ramaḍān was made obligatory, the Prophet ﷺ ceased commanding the companions to fast ‘Āshūrā’ and stopped emphasizing it. And the ḥadīth of ‘Ā’ishah on that subject has already been mentioned.
There is a report in the Ṣaḥīḥayn on the authority of Ibn ‘Umar who said,
عن ابن عمر رضي الله عنهما قال: صام النبي صلى الله عليه وسلم عاشوراء وأمر بصيامه فلما فرض رمضان ترك ذلك وكان عبد الله لا يصومه إلا أن يوافق صومه
“The Prophet ﷺ fasted ‘Āshūrā’ and commanded its fasting. But then when Ramaḍān was made obligatory he left that off.”Reported by Al-Bukhārī 1892 and Muslim 1126
The Fourth State
The Prophet ﷺ decided in the latter part of his life to not single out the fast on ‘Āshūrā’ but rather to include another day along with it in order to differ from the Ahl al-Kitāb in regards to their fasting of it.
So it comes in Ṣaḥīḥ Muslim on the authority of Ibn ‘Abbās that:
عن ابن عباس رضي الله عنهما أنه قال حين صام رسول الله صلى الله عليه وسلم عاشوراء وأمر بصيامه قالوا: يا رسول الله إنه يوم تعظمه اليهود والنصارى فقال رسول الله صلى الله عليه وسلم: “فإذا كان العام المقبل إن شاء الله صمنا اليوم التاسع” قال: فلم يأت العام المقبل حتى توفي رسول الله صلى الله عليه وسلم
When Allah’s Messenger ﷺ fasted ‘Āshūrā’ and commanded it to be fasted, the Companions said, “O Messenger of Allah, this is a day which the Jews and Christians venerate,” so Allah’s Messenger ﷺ replied, “When next year comes we will fast the ninth day, In shā Allah.” And Ibn ‘Abbās said, “But the next year did not come up until the Messenger of Allah ﷺ passed away.”Reported by Muslim 1134
– Extracted from The discussion regarding the day of ‘Āshūrā’, The acts of Muḥarram, from the book “Laṭāʾif al-Maʿārif fīmā li-Mawāsim al-ʿĀm min al-Waẓāʾif” by Al-Imām al-Ḥāfiẓ Ibn Rajab al-Ḥanbalī. Ḥadīth references added by Abu Aasiyah Muzaffar al-Hindi غفر الله له