It is mustahabb [recommended] to fast both the ninth and the tenth, because the Prophet (peace and blessings of Allaah be upon him) fasted the tenth and intended to fast the ninth. [Al-Shaafa’i and his companions, Ahmad, Ishaaq and others]
If one were to ask, what is the wisdom behind fasting the ninth as well as the tenth?
The answer is:
Al-Nawawi (may Allaah have mercy on him) said: The scholars among our companions and others said that there are several reasons for recommending fasting on the ninth day (Tasoo’a’):
1 – The intention behind it is to be different from the Jews who limit their fasting to the tenth day. This was narrated from Ibn ‘Abbaas.
2 – The intention was to join the fast of ‘Ashoora’ to another day, just as it is not allowed to fast on a Friday on its own [but it is allowed if one fasts the day before or the day after as well].
3 – The idea is to be on the safe side and make sure one is fasting on the tenth, in case the moon sighting was not accurate and what people think is the ninth is actually the tenth.
The strongest of these reasons is in order to be different from the People of the Book. Shaykh al-Islam Ibn Taymiyah said: The Prophet (peace and blessings of Allaah be upon him) forbade resembling the People of the Book in many ahaadeeth. For example, he said concerning ‘Ashoora’: “If I live until next year I will certainly fast the ninth.” Al-Fataawa al-Kubra, part 6.
Ibn Hajar (may Allaah have mercy on him) said, commenting on the hadeeth “If I live until next year I will certainly fast the ninth”:
His concern to fast the ninth may be understood as meaning that he would not limit himself to that, rather that he would add it to the tenth, either to be on the safe side, or to be different from the Jews and Christians, which is more likely to be correct; this is what may be understood from some of the reports narrated by Muslim.” [From Fath al-Baari, 4/245.]
Source: Islam Q&A