When the sun was eclipsed at the time of the Messenger of Allah, he went out rushing nervously to the mosque, dragging his cloak behind him, and led the people in prayer.
He told them that the eclipse was one of the signs of Allah, with which Allah makes His slaves afraid, and that it may be the cause of punishment coming upon the people.
He commanded them to do that which could prevent the punishment, so he commanded them to pray when an eclipse happens, and to make du’aa’, seek His forgiveness, give charity, free slaves and do other righteous deeds so that the punishment would go away and not befall the people.
The Messenger of Allah said: ‘The sun and the moon are two signs from Allah, and they do not become eclipsed for the death or the birth of anyone. If you see that, hasten to remember Allah and to pray.’”
According to another hadeeth: “Call on Allah and pray until [the eclipse] is over.”