Q:

On Judgement day, everything will be destroyed in the earth and heavens

On the Day of Judgement everything in the heavens and earth will be destroyed, but what if humans would have inhabited other planets or even other galaxies by then, will they be destroyed?

A:

On the day of judgment, earth will not be the only thing to be destroyed, everything that exists, everything in the universe, every galaxy, everything that was created, will seize to exist (except Allah). So inhabiting other planets will not save any living being from the day of judgment

