The Prophet ﷺ used to order the fasting of Ashura before the fasting of Ramadan was prescribed. When Ramadan was made obligatory, whoever wished fasted Ashura and whoever wished did not.
حدثنا عثمان بن عمر قال أخبرنا يونس عن الزهري عن عروة
أن النبي ﷺ كان يأمر بصيام عاشوراء قبل أن ينزل رمضان فلما فرض رمضان كان من شاء صام ومن شاء أفطر