…he shall not enter the sanctuary all the time… (Leviticus 16:2)
This verse overtly prohibits the Kohein Gadol (High Priest) from entering the Holy of Holies except to do the Yom Kippur service. It includes an admonition that regular kohanim should likewise not hang around the heichal (the “Holy”) when they are not involved in the Temple service. There’s a significant difference between the prohibition against the Kohein Gadol entering the Holy of Holies and a regular kohein just hanging around the Holy; the Kohein Gadol would be liable to a Heavenly death sentence for entering the Holy of Holies unnecessarily, which is not the case for a regular kohein lazing about the Temple.
The reason for this prohibition is clear: the Beis HaMikdash is not a kohein’s house or his social club. It’s a Temple dedicated to the service of God. We have this problem in our synagogues, as well. Thank God, we feel comfortable in our shuls. Unfortunately, we sometimes become complacent and forget that they’re not community centers. We forget that we’re there to talk to God, not to our friends. This mitzvah carries an important lesson applicable to all of us today.
This mitzvah applies to kohanim in Temple times. It is the discussed in the Talmudic tractate of Menachos on page 27b and in the Mishna in the first chapter of tractate Keilim. This mitzvah is codified in the Mishneh Torah in the second chapter of Hilchos Biyas HaMikdash and is #68 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.