The whole verse says, "So you shall know that I, YHWH your God, dwells in Zion, my holy mountain. And Jerusalem shall be my sanctuary, and strangers shall never again pass through it."
The apparent xenophobic nature of this verse is unattractive. One scholar has attempted to locate such a prophecy to a specific time when Israel was confronted by an enemy, I believe, to take the edge off a bit. Wolff says, in sum, "that doesn't work. Don't do that!" I do not believe, after reading Barton's commentary, that he really knows what to do with the statement. I believe the question in Joel, especially when taken as part of a broad Twelve, is who is the foreigner? Or put positively, who is Israel? It is quite vague when one takes time to understand Joel.
Here I think an extended quotation of Wolff's comment is helpful (1977, Joel and Amos):
“Only the second sentence spells out that, due to Yahweh’s dwelling in the sanctuary of Zion, Jerusalem as a whole becomes a ‘sanctuary,’ i.e., Yahweh’s inalienable possession. Thus in Jerusalem already chosen as ‘city of the sanctuary’ in Is 52:1… In both these cases [i.e., Is 52:1 and Zech 14:21], as well as in Na 2:1 [1:15], a third statement is associated with this, namely, that no unclean and uncircumcised person (Is 52:1), no merchant (‘Canaanite,’ Zech. 14:21), no worthless person (Na 2:1 [1:15]) will pass ‘through’ the city. In Joel 4:17 those excluded are called ‘strangers,’ a designation used for foreigners as those who are outside of the cultus. [Wolff notes: “Consequently, one should not attempt to base a dating on this verse, as does Marco Treves (‘Date’ 153-154).’] Thus Yahweh’s self-manifestation as the God of the covenant is summarized in the assertion that his, as the one present on Zion, appropriates all Jerusalem inalienable to himself and refuses access once and for all to everything pagan. Thereby is highlighted the salvific effect of the judgment of the judgment on the nations. When Jerusalem is called a ‘sanctuary,’ this is meant to stress not so much its cultic purity (thus Zech 14:21), as rather its inviolable assignment to the God of the covenant, making it a refuge and a place of shelter for the people of the covenant (cf. 4:16b and 3:5).”
This quotation reminds one of the prophetic office Joel takes on for God to a struggling people. His 4:17 statement is eschatological, yes, but also eccesiological, soteriological, etc. It points to much more than a cultus, a a single nation that is picking on Israel, or impending natural disasters of a historical sort (though, it certainly gives assurance in these times, as the Word of God does today for His people). Rather, it points to God's total plan of redemption.
In Wolff's quotation:
I hear Acts 1:8 - all the earth is the Lord's sanctuary, the implications of which are made evidently clear in James' use of Amos 9 in Acts 15. See Revelation 21:9-26 for agreement.
I hear, "promise." "This promise is for you and for your children and for all who are far off, everyone whom the Lord our God calls to himself," Peter says in Acts 2:39. God self-manifests as the God of the covenant.
I hear, Peter's revelation in Acts 10. "Do not call common what I have made clean." Suddenly all who hear the call to call upon the name of the LORD. The lines are blurred. Who's Israel? And who is consequently now simply a Jew?
I hear, finally then, that there could not be an alien in the sanctuary of Jerusalem. Acts 15 says why. If Jerusalem is God's sanctuary, because this is where He tabernacles, Acts 15 says such tabernacling is done is accumulation of all believers (Amos 9:11-12). It is easy to see thus why it is impossible for one who has not called upon the Lord to not be able to pass through. And why God's land is now the earth, and not one geographic location.
And, much more can be heard once the stereotypical historical-critical "entitlements" (as Barton calls them in a positive light, see Joel and Obadiah, 93) are regarded as secondary.
Jew and Gentile alike are in the Valley of Jehoshaphat, the Lord roars and is a refuge for His people. Who will call upon His name? So was Joel xenophobic? No. He was Hadephobic.