Fasting on Ashura, the tenth of Muharram, is prescribed and recommended.
Hafiz Ibn Abd al-Barr (may Allah have mercy on him) (463 AH) said:
[لا يختلف العلماء أن يوم عاشوراء ليس بفرض صيامه ولا فرض الا صوم رمضان]
There is no disagreement among the people of knowledge that fasting on Ashura is not obligatory; the only obligatory fasts are those of Ramadan.
Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrates that the Messenger of Allah ﷺ said:
[أفضل الصيام، بعد رمضان، شهر الله المحرم]
After the month of Ramadan, the most excellent fast is that of Muharram.
Sayyiduna Mu’awiyah ibn Abi Sufyan (may Allah be pleased with them both) said from the pulpit that he heard the Messenger of Allah ﷺ say:
[هذا يوم عاشوراء ولم يكتب الله عليكم صيامه، وأنا صائم، فمن شاء، فليصم ومن شاء، فليفطر]
This is the day of Ashura. Allah has not made fasting on this day obligatory. Whoever wishes may fast, and whoever wishes may leave the fast; as for me, I am fasting.
Sayyiduna Abu Qatadah al-Ansari (may Allah be pleased with him) narrates that the Messenger of Allah ﷺ was asked about fasting on Ashura, and he said:
[يكفر السنة الماضية]
It is an expiation for the sins of one year.
Sayyiduna Abdullah ibn Abbas (may Allah be pleased with them both) narrates that the Messenger of Allah ﷺ said:
[إن عشت إن شاء الله إلى قابل صمت التاسع؛ مخافة أن يفوتني يوم عاشوراء]
If I live, then, if Allah wills, next year I will (also) fast on the ninth of Muharram, out of fear that I might miss the day of Ashura.
Hafiz al-Bayhaqi (may Allah have mercy on him) (458 AH) said:
[أما حدیث التاسع فیحتمل عندی وجوہا، أحدھا: أن یرید صومہ احتیاطا، فربما نقص الھلال ویکون الغیم، فتکمل العدة ثلاثین، فیکون التاسع فی العدد ھو العاشر من الھلال، فأحب أن لا یفوتہ]
The hadith about fasting on the ninth of Muharram can carry several meanings, one of which is that the Prophet ﷺ intended to fast on the ninth of Muharram as a precaution. That is, the crescent (of Dhul-Hijjah) may have been that of the 29th, with clouds on that day, so that thirty days of Dhul-Hijjah would be completed. In this way (when the fast of the ninth of Muharram is observed), the day that was reckoned to be the ninth of Muharram would in fact be the tenth of Muharram. So he ﷺ wished that the fast of Ashura should not be missed (in this way).
Sayyiduna Abdullah ibn Abbas (may Allah be pleased with them both) narrates that the Messenger of Allah ﷺ said:
[إذا كان العام المقبل إن شاء الله صمنا اليوم التاسع قال: فلم يأت العام المقبل، حتى توفي رسول الله صلى الله عليه وسلم]
Next year, if Allah wills, we will (also) fast on the ninth of Muharram. But before the next year came, the Messenger of Allah ﷺ passed away.
The words of one narration are:
[لئن بقيت إلى قابل لأصومن التاسع]
If I live until next year, I will (also) fast on the ninth of Muharram.
Sayyiduna Abdullah ibn Abbas (may Allah be pleased with them both) said:
[إذا رأيت هلال المحرم فاعدد، وأصبح يوم التاسع صائما، قلت: هكذا كان رسول الله صلى الله عليه وسلم يصومه؟ قال: نعم]
When you see the crescent of Muharram, start counting the days, and fast on the ninth. I (al-Hakam ibn al-A’raj) said: Did the Prophet ﷺ fast on this very day? He said: Yes.
Sayyiduna Abdullah ibn Abbas (may Allah be pleased with them both) said:
[صوموا التاسع والعاشر وخالفوا اليهود]
Fast on the ninth and the tenth of Muharram and oppose the Jews.