That one impure should not enter the Temple mount: That anyone who is impure is prevented from entering the camp of the Levites (see Sefer HaMitzvot, Negative Commandments 78), the embodiment of which for the generations is the Temple mount. And about this is it stated (Deuteronomy 23:11), “If anyone among you has been rendered unclean by a nocturnal emission, he must leave the camp, and he must not enter the camp.” And so did they, may their memory be blessed, say (Pesachim 68a), “‘He must leave the camp’ — that is the camp of the Divine Presence; ‘and he must not enter the camp’ — that is the camp of the Levites. Ravina challenged it strongly, ‘And I could say, this and that are the camp of the Divine Presence, and [the latter part of the verse] is to [make one] transgress [both] a positive and a negative commandment.’ If so, the verse should have written, ‘he should not come into’” — which is to say that, if so that it was only speaking about one camp, it should have stated, “he should not come into it,” as it already mentioned “camp” at the beginning of the verse. “[So] why do I need [the word] “camp”? To give him a different camp” — which is to say that since it mentioned “camp” another time, the verse was hinting to a different camp — and that is the camp of the Levites, that any one who is impure should not enter it.
And this commandment that one impure should not enter is practiced both by males and by females at the Temple Mount even in our days, and like the matter stated by the verse (Leviticus 26:31), “and make your holy places desolate” — and they, may their memory be blessed, expounded (Megillah 28a), “Their holiness is upon them even when they are desolate.” And [it is] as I wrote above (Sefer HaChinukh 184, 363).
שֶׁלֹּא יִכָּנֵס טָמֵא לְהַר הַבַּיִת – שֶׁנִּמְנַע כָּל טָמֵא (עי' ספהמ"צ להרמב"ם ל"ת עח) מֵהִכָּנֵס בְּמַחֲנֵה לְוִיָּה שֶׁדִּמְיוֹנָהּ לְדוֹרוֹת הַר הַבַּיִת, וְעַל זֶה נֶאֱמַר (דברים כג יא) כִּי יִהְיֶה בְךָ אִישׁ אֲשֶׁר לֹא יִהְיֶה טָהוֹר מִקְּרֵה לָיְלָה לֹא יָבֹא אֶל תּוֹךְ הַמַּחֲנֶה. וְכֵן אָמְרוּ זִכְרוֹנָם לִבְרָכָה בִּפְסָחִים (סח, א) וְיָצָא אֶל מִחוּץ לַמַּחֲנֶה זוֹ מַחֲנֵה שְׁכִינָה, לֹא יָבֹא אֶל תּוֹךְ הַמַּחֲנֶה זוֹ מַחֲנֵה לְוִיָּה. מַתְקֵף לַהּ רָבִינָא, וְאֵימָא אִידִי וְאִידִי בְּמַחֲנֵה שְׁכִינָה, וְלַעֲבֹר עָלָיו בַּעֲשֵׂה וְלֹא תַעֲשֶׂה? אִם כֵּן נִכְתֹּב קְרָא לֹא יָבֹא אֶל תּוֹךְ, כְּלוֹמַר שֶׁאִם כֵּן דִּבְמַחֲנֶה אַחַת לְבַד יְדַבֵּר, הָיָה לוֹ לוֹמַר לֹא יָבֹא תּוֹכָהּ, שֶׁכְּבָר הִזְכִּיר מַחֲנֶה בְּרֹאשׁ הַכָּתוּב, הַמַּחֲנֶה לָמָּה לִי? לִתֵּן לוֹ מַחֲנֶה אַחֶרֶת, כְּלוֹמַר מִשֶּׁהִזְכִּיר מַחֲנֵה פַּעַם אַחֶרֶת לְמַחֲנֶה אַחֵר רָמַז הַכָּתוּב, וְהִיא מַחֲנֵה לְוִיָּה, שֶׁלֹּא יָבוֹא בָּהּ כָּל טָמֵא.
That one impure should not enter the Temple mount: That anyone who is impure is prevented from entering the camp of the Levites (see Sefer HaMitzvot, Negative Commandments 78), the embodiment of which for the generations is the Temple mount. And about this is it stated (Deuteronomy 23:11), “If anyone among you has been rendered unclean by a nocturnal emission, he must leave the camp, and he must not enter the camp.” And so did they, may their memory be blessed, say (Pesachim 68a), “‘He must leave the camp’ — that is the camp of the Divine Presence; ‘and he must not enter the camp’ — that is the camp of the Levites. Ravina challenged it strongly, ‘And I could say, this and that are the camp of the Divine Presence, and [the latter part of the verse] is to [make one] transgress [both] a positive and a negative commandment.’ If so, the verse should have written, ‘he should not come into’” — which is to say that, if so that it was only speaking about one camp, it should have stated, “he should not come into it,” as it already mentioned “camp” at the beginning of the verse. “[So] why do I need [the word] “camp”? To give him a different camp” — which is to say that since it mentioned “camp” another time, the verse was hinting to a different camp — and that is the camp of the Levites, that any one who is impure should not enter it.
מִשָּׁרְשֵׁי הַרְחָקַת הַטֻּמְאָה מִמְּקוֹם הַקֹּדֶשׁ, כָּתַבְתִּי כַּמָּה פְּעָמִים בְּסִפְרִי (מצוה שסב).
I have written about the roots of distancing impurity from the holy place a few times in my book (Sefer HaChinukh 362).
דִּינֵי הַמִּצְוָה. מְבֹאָרִים בְּפֶרֶק רִאשׁוֹן מִמַּסֶּכֶת כֵּלִים [הלכות ביאת מקדש פ"ג].
The laws of the commandment are elucidated in the first chapter of Tractate Kelim. (See Mishneh Torah, Admission into the Sanctuary 3.)
וְנוֹהֶגֶת מִצְוָה זוֹ שֶׁלֹּא לְהִכָּנֵס טָמֵא, בֵּין זָכָר בֵּין נְקֵבָה, בְּהַר הַבַּיִת אֲפִלּוּ בַּזְּמַן הַזֶּה, וּכְעִנְיָן שֶׁאָמַר הַכָּתוּב (ויקרא כו, לא) וַהֲשִׁמּוֹתִי אֶת מִקְדְּשֵׁיכֶם. וְדָרְשׁוּ בּוֹ זִכְרוֹנָם לִבְרָכָה (מגלה כח, א) קְדֻשָּׁתָן עֲלֵיהֶם אֲפִלּוּ כְּשֶׁהֵן שׁוֹמֵמִין, וּכְמוֹ שֶׁכָּתַבְתִּי לְמַעְלָה (מצוה קפד, שסג).
And this commandment that one impure should not enter is practiced both by males and by females at the Temple Mount even in our days, and like the matter stated by the verse (Leviticus 26:31), “and make your holy places desolate” — and they, may their memory be blessed, expounded (Megillah 28a), “Their holiness is upon them even when they are desolate.” And [it is] as I wrote above (Sefer HaChinukh 184, 363).