How could David leave ארץ ישראל? Didn’t he just compare that to worshipping אלהים אחרים?
And in fact, the commentators say this is exactly what David was talking about. When he said היום, he meant literally “today”—I have been forced into exile today, to the Philistines:
The משבצות זהב points out that there is a problem with this interpretation, since ארץ פלשתים really is part of ארץ ישראל:
So we have the Mishna that explains that Ashkelon (in the ancient land of the Philistines) is not part of ארץ ישראל, though the נביא says that it is. While Tosaphot doesn’t bring this, the idea that ארץ פלשתים is part of ארץ ישראל is implied in the Torah as well:
Tosaphot brings two explanations:
The Ri says that Ashkelon is in fact in Israel, but it’s so far from the center of the population that we consider it foreign. Rabbeinu Tam makes a distinction between the first commonwealth, כבוש עולי מצרים, and the second, כבוש עולי בבל, that is reflected in the Rambam:
It’s not clear from the Rambam why there should be a difference between כיבוש and חזקה. Rav Shaviv of the Herzog Institute has a summary of some of the discussion. Rav Soloveitchik explains the concept of חזקה in this context:
Thus the קדושה of ארץ ישראל in the days of Ezra was derived from the קדושה of the בית המקדש, and was not removed with the Roman exile. As an aside, the question then arises: why wasn’t כבוש עולי מצרים קידשה לשעתה ולעתיד לבוא? The Rav doesn’t address that question; he is only interested in the halachic implications. But telelogically I think the answer is that given by the אור החיים among others:
A מקדש-centered conquest at that time, led by leaders of the caliber of Moshe, would have resulted in a קדושה that would never be destroyed. Instead, when the Jewish people sinned, they would have been the ones to be destroyed.
But this idea, that David’s sojourn in ארץ פלשתים was in a quasi-Israel, may be how Radak understands David’s situation:
ארץ פלשתים may have had the holiness of ארץ ישראל when Joshua conquered it, but this is the Middle East. No battle is ever over; no one stays beaten. The Philistines retook their land and in David’s time he considered it חוץ לארץ.
Bleep
And to return to Rashi’s interesting comment:
The phrase בזמן הבית is clearly extraneous; it’s not in the original quote in the Talmud and more to the point, it doesn’t apply to David: there is no בית המקדש. This would appear to have been an interpolation by the censor. Rabbi Steven Weil of the OU likes to point out that there is evidence that most of what we call “censoring” of medieval Jewish manuscripts was actually self-censorship: the Church would be more likely to burn the whole book rather thanoffer a detailed critique of the phrases it didn’t like. The Jewish publishers took out or edited anything that they were afraidmight offend the censor. In the case of Rashi’s commentary, Lisa Fredman (who has a PhD in such things) mentions Domenico Irosolomitano (in the linked lecture, at 23:44 on), a sixteenth century Italian apostate who published Sefer HaZikuk in Hebrew, with a list of books and phrases to be censored (like כל שם גוי גויים, או נכרי נכרים…ימחק ויכתב במקומו: עכו״ם; see Rav Berman’s article).