There are two places in the Qur’an in which it states that the Earth was created before the sky. These verses are:

1)    “He it is Who created for you all that is on earth. Then He Istawâ (rose over) towards the heaven and made them seven heavens and He is the All-Knower of everything.” [Surah Al-Baqarah, verse 29]

2)    “Say: “Do you verily disbelieve in Him Who created the earth in two Days and you set up rivals (in worship) with Him? That is the Lord of the ‘Alamîn (mankind, jinns and all that exists). He placed therein (i.e. the earth) firm mountains from above it, and He blessed it, and measured therein its sustenance (for its dwellers) in four Days equal (i.e. all these four ‘days’ were equal in the length of time), for all those who ask (about its creation). Then He Istawâ (rose over) towards the heaven when it was smoke, and said to it and to the earth: “Come both of you willingly or unwillingly.” They both said: “We come, willingly.” [Surah Fussilat, verse 9-11]

This does not contradict the Saying of Allah in Surah Al-Nazi’aat: “Are you more difficult to create, or is the heaven that He constructed? He raised its height, and He has equally ordered it, Its night He covers with darkness, and its forenoon He brings out (with light). And after that He spread the earth; And brought forth therefrom its water and its pasture;” [Surah Al-Nazi’aat, verse 27-31]

Thus, the earth was created first, without being spread, then the sky was created and then the earth was spread by bringing forth its water and pasture i.e. trees, plants etc.

The meaning of the verse, “He it is Who created for you all that is on earth,” is that He created the original earth along with a measure of sustenance, food etc. that  was going to be on the earth. Hence, here “created” means “measured”, and this agrees with the verse in Surah Fussilaat: “and measured therein its sustenance.”

Shaykh Muhammad Ameen Al-Shinqeeti said, “Firstly, you should know that Ibn ‘Abbas (may Allah be pleased with him) was asked about the conformity of the verse in Surah Al-Sajdah (also called Surah Fussilat) and the verse in Surah Al-Nazi’aat. He replied that Allah first created the earth, before the skies, without spreading it. Then He Istawâ (rose over) towards the skies and made them seven skies in two days. Then he spread the Earth after that, and made mountains, rivers etc. in it.

Hence, basically the Earth was created before the skies, and it was spread with mountains, rivers etc. after creation of the skies. This is proven since Allah said, “And after that (creation of skies) He spread the earth”, but he did not say that he created it (after the creation of skies). Then he explained “spreading” the Earth by “and made mountains, rivers etc. in it.” This explanation by Ibn ‘Abbas of the congruence between the two verses, derived from the obvious meaning of the Noble Qur’an, is clear and does not leave anything to doubt.”