Since there is a mitzva to shave and to have one’s hair cut before the festival, the Sages forbade shaving or getting haircuts during Ḥol Ha-mo’ed. Therefore, even though the general rule on Ḥol Ha-mo’ed is that it is permissible to do melakha which involves caring for one’s body (and thus any bothersome hair may be removed), the Sages still prohibited haircuts and shaving. They were concerned that if haircuts were allowed on Ḥol Ha-mo’ed, people would push off getting haircuts until then, and thus belittle the festival by starting it looking unkempt. Thus, prohibiting haircuts on Ḥol Ha-mo’ed ensured that everyone would get their hair cut before the festival (MK 14a; SA 531:1-2).
In earlier times, when one traveling by caravan from a distant land would arrive too close to the festival to get a haircut before Yom Tov, the Sages were lenient and allowed him to get his hair cut discreetly on Ḥol Ha-mo’ed (MK 13b; SA 531:4-5). Nowadays, though, this leniency is not relevant, as international trips are generally short and haircuts are available just about anywhere. However, if one did manage to get lost in a desolate area for an extended period of time, and then was rescued on the festival, he may discreetly get a haircut on Ḥol Ha-mo’ed.
The prohibition of haircutting applies only to the head and beard. When that hair grows longer than usual, it makes a person look unkempt, and entering into the festival in such a state is belittling it. In contrast, the moustache and other hair is not included in the prohibition, and they may be cut during Ḥol Ha-mo’ed (SA 531:8; SHT ad loc. 15). One who has sores on his scalp may get a haircut, if it lessens his pain or helps him heal (MB 531:21).
One may give a minor a haircut on Ḥol Ha-mo’ed if the child is bothered by his hair length. Since he is not yet obligated to keep the commandments, he is not obligated to prepare for the festival either. Thus the Sages did not include him in the prohibition of Ḥol Ha-mo’ed haircuts (SA 531:6). Those whose custom is to give a boy his first haircut at age three, and to celebrate with a big party, may give him that haircut on Ḥol Ha-mo’ed. Even if his birthday is actually before the festival, the haircut may be delayed until Ḥol Ha-mo’ed in order to increase the joy (Gan Ha-melekh; Sha’arei Teshuva 531:7).
Nowadays there is a serious question: If one shaves daily, is it permitted for him to shave on Ḥol Ha-mo’ed? Some say that the original prohibition stands – the Sages decreed not to shave or get a haircut on Ḥol Ha-mo’ed. Nevertheless, it would seem that if one shaves daily and makes a point of shaving before the festival begins, he may shave during Ḥol Ha-mo’ed. Since he did not neglect to show respect for the festival, and the shave before Yom Tov will not keep him looking respectable throughout the weeklong festival, it is permitted and even a mitzva for him to shave during Ḥol Ha-mo’ed. It is especially a mitzva to shave before Shabbat and before the concluding Yom Tov. However, if his father is stringent in this regard, it is preferable for him to follow his father’s custom rather than possibly offending his father.