Please note that I am dividing this question into two parts. One part consists of Hadith that allegedly say that the Earth was formed before sun, stars, and heavens. The part-2 contains references from Qur'an that say that the Heavens were created before the Earth.
In their explanation of Qur'an 50:38, many Qur'anic commentators cite a narration that seemingly says that the Earth was created before heavens, suns, stars, etc. The following narration has been deemed as authentic by Tabari and it has been cited in his works:-
Now then, this being so, there is (also) a sound tradition from the Messenger of God told us by Hannad b. al-Sari, who also said that he read all of the hadith (to Abu Bakr)- Abu Bakr b. 'Ayyash- Abu Sa'd al-Baqqal- 'Ikrimah- Ibn Abbas: The Jews came to the Prophet and asked him about the creation of the heavens and the earth. He said: God created the earth on Sunday and Monday. He created the mountains and the uses they possess on Tuesday. On Wednesday, He created trees, water, cities and the cultivated barren land. These are four (days). He continued (citing the Qur'an): 'Say: Do you really not believe in the One Who created the earth in two days, and set up others like Him? That is the Lord of the worlds. He made it firmly anchored (mountains) above it and blessed it and decreed that it contain the amount of food it provides, (all) in four days, equally for those asking'- for those who ask. On Thursday, He created heaven. On Friday, He created the stars, the sun, the moon, and the angels, until three hours remained. In the first of these three hours He created the terms (of human life), who would live and who would die. In the second, He cast harm upon everything that is useful for mankind. And in the third, (He created) Adam and had him dwell in Paradise. He commanded Iblis to prostrate himself before Adam, and He drove Adam out of Paradise at the end of the hour. When the Jews asked: What then, Muhammad? He said: 'Then He sat straight upon the Throne.' The Jews said: You are right, if you had finished, they said, with: Then He rested. Whereupon the Prophet got very angry, and it was revealed: 'We have created the heavens and the earth and what is between them in six days, and fatigue did not touch Us. Thus be patient with what you say. (Al-Tabari, Abu Ja’far, Tarikh ar-Rusul wal Muluk, Vol.1, 22)
According to Asbab Ul Nuzul and the narration cited by Tabari above, the Earth was created on Sunday and Monday. On the other hand, stars, sun, moon, Heavens etc were created AFTER earth on Thursday and Friday. This same narration is also cited by Ali Ibn Ahmad Al-Wahidi in his work.
This narration is also found in Tafsir Al-Bhaghawi:-
خلق الله الأرض يوم الأحد والاثنين، والجبال يوم الثلاثاء، والمدائن والأنهار والأقوات يوم الأربعاء، والسموات والملائكة يوم الخميس إلى ثلاث ساعات من يوم الجمعة، وخلق في أول الثلاث الساعات الآجال، وفي الثانية الآفة، وفي الثالثة آدم
According to wikipedia, Bhaghawi primarily relies on 11 reliable chains of narrations, which al-Baghawi mentions in the introduction to his work.
However, I am not sure if Bhaghawi also considers this narration as authentic and I do not know why he cited it in his work.
I think many critics of Islam often cite this narration in order to prove that Islam teaches that the Earth predates heavens and stars because the sequence of creation of Earth, stars, heavens, etc clearly starts with the creation of Earth and then it ends with the creation of heavens, stars, etc. It has been asumed that the creation actually started on Sunday (with the creation of Earth) and the creation ended on Friday (with the creation of star, sun, and moon). This is what the sequence suggests.
Question: What is the reality of this narration? Is this narration authentic? If this narration is authentic, then how can we reconcile this with science? Science CLEARLY states that the heavens, sun, stars, etc were created WAY BEFORE the Earth was created.
Creation Of The Earth Before Heavens In The Qur'an?
The Glorious Qur'an says,
Then He turned towards the heaven when it was ˹still like˺ smoke, saying to it and to the earth, ‘Submit, willingly or unwillingly.’ They both responded, ‘We submit willingly. So He formed the heaven into seven heavens in two Days, assigning to each its mandate. And We adorned the lowest heaven with ˹stars like˺ lamps ˹for beauty˺ and for protection. That is the design of the Almighty, All-Knowing.(Glorious Qur'an 41:11-12)
These verses of Qur'an state that the heaven was still in the period of infancy because it was "smoke-like". Some people suggest that this smoke-like heaven is the seven layers of atmosphere that cover up the Earth. However, the very next verse clearly suggests that the lower heavens were adorned with stars and we know that the seven layers of the amosphere are not "adorned with the stars". So does the Glorious Qur'an say that the Earth was formed BEFORE Heavens as the verse suggests that the heavens was in the state of infancy (i.e. smoky)?
In the commentary of Qur'an 79:30, Tafsir Al-Jalalayn state:-
"and after that He spread out the earth He made it flat for it had been created before the heaven but without having been spread out;"
The following is taken from Ibn Kathir's Abridged version of commentary:-
According to THIS SOURCE,
"The Earth was formed about 4.6 billion years ago, that's 4,600,000,000 years ago. It was formed by collisions of particles in a large cloud of material. Slowly gravity gathered together all these particles of dust and gas and formed larger clumps. These clumps continued to collide and gradually grew bigger and bigger eventually forming the Earth. The earth at this time was very different to how we know it today."
I think the answer lies somewhere in the question. Can any wise person please explain?