The Mishna on our daf teaches that no one was permitted to enter the azarah (courtyard) to participate in the Temple service unless he first performed tevilah – immersed in a mikveh. On Yom Kippur, the kohen gadol performed this tevilah five times, as he walked back and forth between different parts of the mikdash.
Rashi explains the Mishna (the Jerusalem Talmud makes this point, as well) as referring not only to someone who entered the precincts of the Temple to perform avodah (service), but to anyone who had reason to enter the sanctuary, even if he was not planning to participate in the Temple service. Some explain that this is necessary only because a kohen who is found on the premises may be invited to participate in some aspect of the avodah, and therefore must be prepared to do so.
The discussion of tevilah as preparation to enter the mikdash leads the Gemara to teach of another person who needs to go to the mikveh in order to take care of his business in the Temple: a metzorah – a person who has recovered from a case of Biblical leprosy. As is taught in Vayikra 14, and elucidated upon in Massekhet Nega’im, a person who shows the signs of leprosy to a kohen is declared a metzorah. Such a person will be obligated to sit outside the community encampment until he recovers from his illness.
When he sees signs of recovery, he again approaches the kohen, and if he is found to have healed, he waits a week (during which time he remains ritually defiled, but to a lesser extent than during the previous week), at which point he will do tevilah. On the following day he will go to the Temple to bring the appropriate sacrifices and will have blood from the sacrifice placed on his thumb and big toe, at which point he is considered, once again, to have fully recovered and to be ritually pure.