The Mishna (59b) discusses the case of a nazir who may have come into contact with a dead body, who also may be a metzora. In both of these cases (the nazir tameh and the metzora) there is a biblical commandment requiring the person with these conditions to cut his/her hair. The Mishna works to set priorities on which hair cutting takes precedence.
The Gemara on our daf presents a question that Rabbi Shimon ben Yohai’s students asked him – why can’t we have this person shave his head once and have it count for both the requirement of the nazir and the requirement of the metzora? Rabbi Shimon ben Yohai responds that their point would have made sense if the hair removal in both cases served the same purpose. In truth, however, the underlying purpose of the two haircuts differs, and so the same act cannot be used for both. Specifically, the nazir needs to remove his hair, while the metzora shaves to grow his hair, so he can shave it again after the days of his counting.
The metzora under discussion is a metzora muhlat – one who has been examined by the kohen and deemed to be a metzora. Such a person must remove himself from the community until he recovers from his condition. Upon recovery, he brings a sacrifice and purifies himself, returning to his home after he has removed all of his hair (see Vayikra 14:8-9). Once there, he waits another seven days outside his house, at which point he removes his hair a second time, brings another set of sacrifices and then can return to the community. Thus the metzora cuts his hair twice; his first haircut is preparation for the second, unlike the nazir who has no further obligation to grow his hair.