One may not brush or comb one’s hair on Shabbat, because when doing so hairs are pulled out. This is actually a beneficial phenomenon. Every day a person sheds dozens of hairs naturally. People would rather that hairs with weak roots be pulled out during brushing rather than fall out on their own in the course of the day, thus making their hair unkempt and their clothes unsightly. In any event, since one may not brush his hair on Shabbat, brushes are considered muktzeh and may not be moved on Shabbat (SA 303:27).
Nevertheless, one who wishes to make one’s hair neater may use a special brush with soft or widely spaced bristles, so that there is a reasonable chance that it will not pull out hair. Then, even if he does happen to pull out hair, he does not violate a melakha. This is because his intention is not to pull out hair, hair will not necessarily be pulled out, and the brush is not muktzeh. In order to make sure it does not look like he is using a prohibited brush, it is advisable to designate a brush for use specifically on Shabbat (see SSK 14:50).
One may gently rub one’s hair or beard, and one may use one’s fingers to arrange them and to remove anything stuck in them, as long as one is careful not to pull out hairs. Even if these actions might cause hairs to be removed, one may do so, as this is unintentional. One who generally tugs at his beard in a way that causes hair to be pulled out must refrain from doing so on Shabbat.
The Sages forbade braiding hair on Shabbat, because making a braid resembles the melakha of Boneh. Similarly, one may not undo a braid, because this resembles melakha of Soter. One may gather hair into a ponytail, as this does not create a structure. Similarly, one may part one’s hair using one’s hands, but one may not use a brush or comb to do so, as this will pull out hairs (SA 303:26; MB ad loc. 84).
Braiding a wig is also forbidden because it resembles weaving – the melakha of Oreg – while one may not undo a braid because this constitutes “undoing a weave” – the melakha of Potze’a (MB 303:82; SHT ad loc. 71). It is proper to refrain from combing a wig, but one may do so using a soft brush that will not pull out hairs (SSK 14:52). If a wig has become so tangled that it cannot be worn outside, then one may not style it even using one’s hands, as it constitutes Makeh Be-fatish (Ketzot Ha-shulĥan 143, Badei Ha-shulĥan 6).
It is rabbinically prohibited to curl one’s hair, which includes men curling their sidelocks (peyot), because this is similar to Boneh. Straightening hair or sidelocks is prohibited because of Soter. But if the sidelocks were already curled, they may be twirled even though this may tighten the curls, because no new structure is formed (Tiferet Yisrael on Shabbat ch. 10, Yakhin 35; see Ketzot Ha-shulĥan 146, Badei Ha-shulĥan 21).
One may not use hair spray or oil to keep one’s hair in place, because this is similar to Boneh (Rivash as cited in BHL 303:27 s.v. “laĥof”). One may not use these substances on wigs either (SSK 14:56). However, women may spray perfume on their hair or bodies (MB 128:23; SSK 14:56-57).