All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
This story, which occurred during the construction of the Ka’bah, took place during the pre-Islamic period of ignorance and before the advent of Islam, and it was reported by Al-Bukhari and Muslim . What can be deduced from this story is that this is evidence that Prophet Muhammad, sallallaahu ‘alayhi wa sallam, was a true Prophet, and that Allaah The Almighty wanted to protect him from vile matters even before He sent him as a Prophet.
In some other narrations, it is reported that he heard a voice from the sky ordering him to put on his Izaar (lower covering). Al-‘Abbaas asked him (the Prophet, sallallaahu ‘alayhi wa sallam), “What is wrong?” Then, the Prophet said: "I was forbidden from doing so.” Al-‘Abbaas said, "I concealed this matter until Allaah showed his prophecy [sent him as a Prophet]."
As regards the Prophet Moosa (Moses) taking the hot coal [instead of the jewel], then this was from Allaah The Almighty in order to save Moosa from the tyranny of Pharaoh as the latter wanted to kill him.
The interpreters of the Quran reported that Sa’eed ibn Jubayr and Mujaahid said that the disability of the tongue of Moosa was a result of a hot coal which he had put in his mouth (during his childhood). This happened when the wife of Pharaoh ordered him to do so to save him from being punished or killed, when he pulled the beard of Pharaoh and Pharaoh said, "He is an enemy to me". Then his wife told him to let Moosa choose between a jewel and a hot coal put on a tray and Moosa chose the hot coal. Then she said, "He does not perceive or understand anything" trying to prevent him from punishing and killing Moosa .
Allaah Knows best.