كتاب الصيام
13
The Book of Fasting
(19)
Chapter: Fasting on the day of Ashura'
(19)
باب صَوْمِ يَوْمِ عَاشُورَاءَ ‏‏
Sahih Muslim 1125 a

'A'isha (Allah be pleased with her) reported that the Quraish used to fast on the day of 'Ashura in the pre-Islamic days and the Messenger of Allah (ﷺ) also observed it. When he migrated to Medina, he himself observed this fast and commanded (others) to observe it. But when fasting during the month of Ramadan was made obligatory he said:

He who wishes to observe this fast may do so, and he who wishes to abandon it may do so.
حَدَّثَنَا زُهَيْرُ بْنُ حَرْبٍ، حَدَّثَنَا جَرِيرٌ، عَنْ هِشَامِ بْنِ عُرْوَةَ، عَنْ أَبِيهِ، عَنْ عَائِشَةَ، - رضى الله عنها - قَالَتْ كَانَتْ قُرَيْشٌ تَصُومُ عَاشُورَاءَ فِي الْجَاهِلِيَّةِ وَكَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم يَصُومُهُ فَلَمَّا هَاجَرَ إِلَى الْمَدِينَةِ صَامَهُ وَأَمَرَ بِصِيَامِهِ فَلَمَّا فُرِضَ شَهْرُ رَمَضَانَ قَالَ ‏ "‏ مَنْ شَاءَ صَامَهُ وَمَنْ شَاءَ تَرَكَهُ ‏"‏ ‏.‏
Reference : Sahih Muslim 1125 a
In-book reference : Book 13, Hadith 143
USC-MSA web (English) reference : Book 6, Hadith 2499
  (deprecated numbering scheme)