Is there any explanation for why Quraysh were not subject to punishment after belying the miracle of the splitting of the moon even though when they asked the Prophet, sallallaahu ‘alayhi wa sallam, to transform one of Makkah's mountains into gold, Gabriel, peace be upon him, came and told the Prophet that if a miracle came to them and they denied it, punishment would be inflicted upon them? So why did this not happen to Quraysh when they denied the miracle of the splitting of the moon?
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, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Without a doubt, the incident of the splitting of the moon was a miracle that took place in support of the Prophet, sallallaahu ‘alayhi wa sallam, when the disbelievers of Quraysh asked him to show them a miracle to prove his truthfulness. The noble Quran recorded this incident, and it was also authentically reported in the Sunnah. Anas narrated, "The people of Makkah asked the Prophet, sallallaahu ‘alayhi wa sallam, to show them a miracle, so he showed them the splitting of the moon." [Al-Bukhari] The splitting of the moon was not specifically requested by Quraysh per se, but they asked for a proof of the truthfulness of the Prophet, sallallaahu ‘alayhi wa sallam. So Allah Almighty showed them this miracle, which is said by astronauts to have been proven, as mentioned in lectures by Professor Zaghlool An-Najar, the well-known scholar.
As for the miracles that were specifically requested by the disbelievers, it is these about which Allah Almighty says (what means): {And nothing has prevented Us from sending signs except that the former peoples denied them...} [Quran 17:59] Ibn Al-Qayyim said:
Allah Almighty demonstrates that it is an unchanging norm of His that if He sends miracles which His servants ask for and they then disbelieve in them, He will hasten punishment for them. Moreover, they had already witnessed miracles of him exceeding those that they asked for: In front of them, he pointed to the moon, and it split into two parts.
Similar words were said by Al-Qurtubi . Requesting such miracles on the part of the polytheists was not intended for reaching the truth and establishing proof of it, but it was rather rooted in obstinacy, disbelief, and persistence in mockery. If the requested miracles had come to them and they then remained disbelievers, punishment would have descended upon them. Hence, the Prophet, sallallaahu ‘alayhi wa sallam, was given the choice between fulfilling their requests, but they would be punished if they disbelieved, and giving them respite. He, sallallaahu ‘alayhi wa sallam, chose the latter, as he showed forbearance toward them more than once. Ibn Katheer
said,
That is why Allah Almighty says about those people (what means): {And [even] if We opened to them a gate from the heaven and they continued therein to ascend, they would say, "Our eyes have only been dazzled. Rather, we are a people affected by magic."} [Quran 15: 14-15]
Allah knows best.
You can search for fatwa through many choices