Isaiah 45:18: “For thus says the Lord who created the heavens, God Himself who formed the earth and made it. He has established it, He created it not in vain. He formed it to be inhabited.”

 When we look at Genesis 1:2 we find the earth uninhabitable!

Probably what had already happened was the casting of Lucifer from Heaven (though he still had access to God’s presence, Job 1) and Lucifer’s anger taken out on a previously perfectly created earth. The result was the chaotic state of Genesis 1:2. God restored the earth in verses 3-25.