Towards the beginning of Parashat Shoftim (16:21), the Torah presents the prohibition against planting trees alongside the altar, a prohibition which Chazal understood as forbidding planting trees anywhere in the Temple courtyard, or, according to Rashi, anywhere on the entire Temple Mount.
Maharam Shick, in one of his responsa (O.C. 79), writes that this command includes the requirement to uproot trees that were planted on the sacred site. Just as the Torah forbids planting on the Temple Mount, it also requires uprooting trees that were planted there. Maharam Shick notes that both the Rambam (Hilkhot Avodat Kokhavim 6:9) and the Ramban (commentary here in Parashat Shoftim) explain this prohibition as based upon the ancient pagan practice to adorn their temples and sites of worship with large trees. Accordingly, it stands to reason that this command not only forbids planting trees, but also requires uprooting trees that were planted at the sacred site.
Others, however, disagree. Rav Yaakov Ettlinger, in Binyan Tziyon (9), draws proof from the other instance where the Torah forbids planting – namely, the prohibition of kil’ayim, which forbids planting different species together (“sadekha lo tizra kil’ayim” – Vayikra 19:19). The Gemara in Masekhet Makkot (21b) infers from the Torah’s formulation of the law of kil’ayim that one must destroy agricultural products grown in violation of this law. (Specifically, the phrase “sadekha lo tizra kil’ayim” is preceded by the phrase “behemtekha lo tarbi’a kil’ayim,” such that the verse may be read as, “kil’ayim sadekha lo tizra,” forbidding one to maintain a situation of kil’ayim in his field.) The clear implication of the Gemara’s discussion, Rav Ettlinger asserts, is that we would have presumptively concluded that the kil’ayim prohibition only forbids planting, as a special textual inference was necessary to deduce a requirement to destroy products which were grown in violation of the law. Naturally, then, in the case of trees planted in the area of the Beit Ha-mikdash, they do not need to be uprooted, since no special inference is made extending the Torah’s command to include a requirement to destroy such trees.
Rav Aryeh Levine, in a letter reproduced in Zikhron Torat Raphael (p. 236), cited two other proofs that there is no obligation to uproot trees that were planted in the area of the Beit Ha-mikdash. First, in the final chapter of Sefer Yehoshua, we read that Yehoshua held a formal ceremony before his death in Shekhem reaffirming the nation’s commitment to their covenant with God, whereupon Yehoshua designated a stone as a symbol of the covenant, placing the stone “underneath the oak that was in the Sanctuary of the Lord” (24:26). This clearly indicates that a tree stood in the area of the Sanctuary, this proving that there is no requirement to uproot trees planted in the area of the Temple. However, one may easily refute this proof by noting that this was not the actual site of the Mishkan, which stood at this time in the city of Shilo, and not in Shekhem. The site where Yehoshua assembled the nation is called “Mikdash Hashem” only because – as Rashi and the Radak explain – the ark was brought to that location from Shilo for the special ceremony. It certainly seems reasonable to assume that the formal laws that applied to the site of the Beit Ha-mikdash did not apply to the area where the ark was temporarily brought.
Rav Aryeh Levine’s second proof is drawn from Malbim’s comments on the Torah’s formulation of the kil’ayim prohibition. Malbim makes the observation that rather than command, “Do not plant kil’ayim in your field,” the Torah instead commands, “In your field – do not plant kil’ayim.” This formulation, Malbim explains, implies that the Torah forbids not merely the act of planting, but rather having kil’ayim in one’s field. Hence, Rav Levine noted, here in Parashat Shoftim, where the Torah commands, “Do not plant an asheira or any tree alongside the altar,” the focus is on the act of planting, and not the presence of a tree in the sacred domain. Hence, there is no requirement to uproot a tree that was planted in the area of the Beit Ha-mikdash.
(Taken from Rav Tzvi Weinberg’s weekly Kav Ve-naki, Parashat Shoftim, 5778)