A nesek is a form of tzara’as that a person might get in the scalp or beard. In a nesek, the hair is weak and yellow-colored. If the spot requires quarantine to determine if it is in fact a nesek, then the person shaves, or has someone else shave him, leaving a perimeter around the potential nesek unshaved. In this way, the kohein will be able to determine whether the spot is pure or impure. Accordingly, the afflicted individual is prohibited from shaving the affected area as this will skew the results.
The reason for this prohibition is that tzara’as is a spiritual affliction, sent as a consequence of slander and gossip. For a person to shave his quarantined spot is to attempt to thwart the Divine Will regarding his deeds. This is just making things worse. If he is guilty of lashon hara, he should take his lumps and resolve to change his ways rather try trying to sneak out of his penalty. In the end, he can’t hide from God, so he should accept his situation, which he brought upon himself anyway.
You will note that the word “v’hisgalach” (“he shall be shaved”) has a larger than average letter gimmel in a Torah scroll (reflected in most Chumashim). There are a variety of homiletic explanations for this (for example, gimmel is also the Hebrew numeral for three and this haircut is different from others in three ways, a child traditionally gets his hair cut at age three, etc.). However, pragmatist that your humble author is, I favor the simple explanation that this is the middle verse in the Torah and the enlarged letter marks that milestone. (See Talmud Kiddushin 30a for more on the midpoint of the Torah in terms of counting letters, words and verses.)
This mitzvah applied to both men and women at a time when there were kohanim trained to identify tzara’as (which is no longer the case). The details of this mitzvah are discussed in the Mishna in tractate Negaim. It is codified in the Mishneh Torah in the eighth chapter of Hilchos Tumas Tzara’as and is #307 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.