God refers to cities & land as living entities with responsibility before Him. When the land is defiled, the land can spit out its inhabitants through natural disasters, pestilence, famine, etc. But the land can be cleansed when its people return to God.
For the land is defiled; therefore I visit the punishment of its iniquity upon it, and the land vomits out its inhabitants.
Lev 18:25 NKJV