Just as one may do any melakha necessary to prepare food or to take care of the body on Ḥol Ha-mo’ed, so too one may undergo any medical treatment that is meant to relieve pain, as this too is a bodily need (SA 532:2). Even a healthy person may take medicine and apply an ointment in order to maintain his health.
One who has a painful toothache may go to the dentist for treatment, even if the pain will not go away immediately and he will feel the relief only after the festival. However, one may not do follow-up care on Ḥol Ha-mo’ed, unless it involves either preventing pain or saving a tooth. It is also prohibited to schedule teeth straightening or cleaning for Ḥol Ha-mo’ed. Since these treatments need not be done then, it would belittle the festival, much as intentionally planning to work then would (see SSK ch. 66 n. 88 and 92).
One may not schedule a routine medical checkup for Ḥol Ha-mo’ed, since it does not contribute to the festival in any way. However, if the doctor is a specialist, and if one does not accept the appointment for Ḥol Ha-mo’ed he will lose the opportunity to see a doctor of comparable skill, he may go on Ḥol Ha-mo’ed. This is comparable to preventing a loss.
One who needs surgery should try to schedule it before the festival. If this is not possible, and if waiting until after the festival could cause him to suffer or his condition to deteriorate (even though no danger to life is involved), the surgery may be performed on Ḥol Ha-mo’ed.
If one’s glasses broke, and he needs them during the festival, he may take them to an optician to have them fixed on Ḥol Ha-mo’ed. This is considered a bodily need. However, one may not get new frames for aesthetic reasons, and he may not have sunglasses repaired unless he wears them for health reasons (Igrot Moshe, OḤ 3:78; SSK ch. 66, n. 88).