The Eliyahu Rabba (a”h) established a rule that anything forbidden by halacha during the nine days from Rosh Chodesh Av through Tisha B’Av is also forbidden on a fast day. According to this position, it would be forbidden for Ashkenazim to take a haircut on a fast day, because Ashkenazim follow the custom of refraining from haircutting throughout the three weeks from Shiva Asar B’Tamuz until Tisha B’Av. For them, according to the Eliyahu Rabba, haircutting would be forbidden on fast days just as it is forbidden during the Nine Days.
Sefaradim, however, do not forbid haircuts during the Nine Days; our custom is to forbid haircutting only during “Shavu’a She’chal Bo” – the week of Tisha B’Av. According to the minhag of the Sefaradim, then, haircutting would be permissible on fast days, even if one accepts the theory of the Eliyahu Rabba.
Interestingly enough, Rav Eliezer Waldenberg (a”h), in his sefer Sitz Eliezer, claims that the Eliyahu Rabba refers only to prohibitions that relate to bodily enjoyment. Haircutting, of course, is not forbidden because of any kind of physical enjoyment it brings. Therefore, the Sitz Eliezer argues, even Ashkenazim would allow taking haircuts on fast days, as haircutting is not included in the Eliyahu Rabba’s rule. Of course, Ashkenazim may not take a haircut on Shiva Asar B’Tamuz, as they forbid haircutting throughout the three-week period from Shiva Asar B’Tamuz through Tisha B’Av.
Some other authorities, however, rule that haircutting is indeed forbidden on fast days, for both Ashkenazim and Sefaradim. Rav Chaim Palachi (a”h), in his sefer Ru’ach Chaim, arrives at this conclusion on the basis of a story told in the Gemara, in Masechet Rosh Hashanah. Once the Rabbis of Lod declared a fast day due to a drought, and they later realized that the day they had declared as a fast day was during the chag of Chanukah, when fasting is forbidden. In order to demonstrate that a fast would not be observed on the assigned day, Rabbi Yehoshuah took a haircut. The Tureh Even (a”h) notes that if haircutting served as an indication that the day was not a fast, then quite obviously haircutting is forbidden on fast days. This is the ruling of Rav Chaim Palachi, as mentioned, and also of Chacham Ben Tzion Abba Shaul (a”h), in his sefer Ohr L’tzion.
Ha’Rav Ovadiyah Yosef, however, ruled leniently in this regard, and allowed haircutting on fast days. In his view, there is no reason to refrain from haircutting on a fast day even as a measure of extra piety.
As for the final halacha, then, it is permissible to take a haircut on a fast day, though if one wishes to follow the stringent view and refrain from haircutting on fast days, then “Tavo Alav Berachah.”