All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
Allah says (what means): {And it is We Who were the inheritors.} [Quran 28:58] The meaning is that Allah inherits the dwellings after its people are destroyed as none of their relatives remained and no owner remained for them except Allah. Tafseer At-Tabari reads, “{And it is We Who were the inheritors.}: Allah says that the dwellings that He destroyed had no inheritor amongst them, and it returned as it were before they inhabited it; there is no owner for the dwellings except Allah, to Whom belongs the heritage of the heavens and the earth.”
Also, Fat-h Al-Qadeer, authored by Ash-Shawkaani reads, “And it is We [i.e. Allah] Who were the inheritors amongst them because they did not leave an inheritor who would inherit their homes and their wealth.”
Allah knows best.