Ubayy b. Ka'b said that when an eclipse of the sun took place in the time of God’s Messenger he led them in prayer, reciting one of the long suras, bowing five times and prostrating himself twice. He then stood up for the second rak'a, recited one of the long suras, bowed five times, prostrated himself twice, then sat where he was facing the qibla and made supplication till the eclipse passed.
'Ikrima said that when Ibn ‘Abbas was told that a certain wife of the Prophet had died, he prostrated himself. Someone asked him why he made prostration at such a time, and he replied, “God’s Messenger told us to prostrate ourselves when we saw a sign, and what sign is greater than the departure of the Prophet's wives?”
An-Nu‘man b. Bashir said that when a solar eclipse took place in the time of God’s Messenger he began to pray a series of pairs of rak'as, making requests at the end of them till the sun became clear.
Abu Dawud transmitted it. In a version by Nasa’i it says that when the sun was eclipsed the Prophet prayed as Muslims normally do, bowing and prostrating himself. Another version by him says that when a solar eclipse took place one day the Prophet went out quickly to the mosque and prayed till it cleared. Then he said, “The people in pre-Islamic times used to say that the sun and moon were eclipsed only on account of the death of a great man, but the sun and moon are not eclipsed on account of anyone’s death or on account of his birth, but they are two of God’s creatures. God produces in His creation what He wills; so when either of them is eclipsed pray till it clears or till God produces something.