565. Step Off: The prohibition against ritually impure people ascending the Temple Mount
…he may not enter the midst of the camp. (Deuteronomy 23:11)
A ritually-unclean person was not allowed to enter the machaneh Leviyah, the camp of the Levites. When the Jews camped in the wilderness, this was the center of three concentric circles: the Mishkan (Tabernacle) was in the center, surrounded by the Levite camp, with the rest of the Tribes around that. In later times, the Temple mount was analogous to the Levite camp, being the area surrounding the central holiness. (The status of the Temple mount remains unchanged even when the Temple is in ruins – see Talmud Megilla 28a, that holy places retain their sanctity even when they are desolate.)
The reason for this mitzvah is respect for the Temple and its service. Not only is it unseemly for a person to enter the Temple while in a state of ritual impurity, it’s inappropriate even to enter its environs, which are also an area of elevated sanctity.
This mitzvah applies in all times and places. It is discussed in the Talmud in tractates Pesachim (67a-68a) and in the Mishnah in the first chapter of tractate Keilim. It is codified in the Mishneh Torah in the third chapter of Hilchos Biyas HaMikdash. This mitzvah is #78 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #193 of the 194 negative mitzvos that can be observed today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.