Narrated ‘Abdullah bin ‘Amr :
“When the sun eclipsed in the life-time of Allah’s Apostle an announcement was made that a prayer was to be offered in congregation.”
(the wife of the Prophet (p.b.u.h) In the lifetime of the Prophet the sun eclipsed and he went to the Mosque and the people aligned behind him. He said the Takbir (starting the prayer) and prolonged the recitation (from the Quran) and then said Takbir and performed a prolonged bowing; then he (lifted his head and) said, “Sami allahu liman hamidah” (Allah heard him who sent his praises to Him). He then did not prostrate but stood up and recited a prolonged recitation which was shorter than the first recitation. He again said Takbir and then bowed a prolonged bowing but shorter than the first one and then said, “Sami ‘a-l-lahu Lyman hamidah Rabbana walak-lhamd, (Allah heard him who sent his praises to Him. O our Sustainer! All the praises are for You)” and then prostrated and did the same in the second Raka; thus he completed four bowing and four prostrations. The sun (eclipse) had cleared before he finished the prayer. (After the prayer) he stood up, glorified and praised Allah as He deserved and then said, “The sun and the moon are two of the signs of Allah. They do not eclipse because of the death or the life (i.e. birth) of someone. When you see them make haste for the prayer.” Narrated Az-Zuhri: I said to ‘Ursa, “When the sun eclipsed at Medina your brother (‘Abdullah bin Az-Zubair) offered only a two-Rakat prayer like that of the morning (Fajr) prayer.” ‘Ursa replied, “Yes, for he missed the Prophet’s tradition (concerning this matter).”
(the wife of the Prophet) On the day when the sun Khasafat (eclipsed) Allah’s Apostle prayed; he stood up and said Takbir and recited a prolonged recitation, then he performed a prolonged bowing, then he raised his head and said, “Sami’a-l-lahu Lyman Hamidah,” and then remained standing and recited a prolonged recitation which was shorter than the first. Then he performed a prolonged bowing which was shorter than the first. Then he prostrated and prolonged the prostration and he did the same in the second Raka as in the first and then finished the prayer with Taslim. By that time the sun (eclipse) had cleared He addressed the people and said, “The sun and the moon are two of the signs of Allah; they do not eclipse (Yakhsifan) because of the death or the life (i.e. birth) of someone. So when you see them make haste for the prayer.”
Narrated Abu Bakra:
Allah’s Apostle said: “The sun and the moon are two signs amongst the signs of Allah and they do not eclipse because of the death of someone but Allah frightens His devotees with them.”
The time for Salaat al-Kusoof lasts from the beginning of the eclipse until it is over, because the Prophet SAWS (peace and blessings of Allaah be upon him) said: “When you see that, then pray.” (Agreed upon). According to another hadeeth, “If you see anything of that, then pray until it is over.” (Reported by Muslim).
Salaat al-Kusoof should not be done once the eclipse is over, because the time has gone. If an eclipse ends before one knows about it, one does not have to pray, because the reason for this prayer is no longer there.
The way in which Salaat al-Kusoof is done is to pray two Rak’ahs in which Qur’aan is recited aloud, according to the correct one out of the two scholarly opinions. In the first Rak’ah, one should recite al-Faatihah and a long soorah such as Soorat al-Baqarah or the equivalent, then do a long rukoo’, then raise one’s head and say, “Sami’a Allaahu liman hamidah, Rabbanaa wa laka’l-hamd (Allaah listens to the one who praises Him; our Lord to You be praise)” after standing upright, as in other prayers. Then one should then recite al-Faatihah and another long soorah, shorter than in the first recitation, equivalent in length to Soorat Aal ‘Imraan. Then one should do another long rukoo’ shorter than the first, and when raising one’s head, say, “Sami’a Allaahu liman hamidah, Rabbanaa wa laka’l-hamd hamdan katheeran tayyiban mubaarakan fih, mal’ al-samawaati wa mal’ al-ard wa mal’ ma shi’ta min shay’in ba’d (Allaah listens to the one who praises Him; our Lord to You be praise, much good and blessed praise, filling heaven and earth and whatever You will besides that).” Then he should do two lengthy sujoods, without making the sitting between them too long. Then one should pray the second rak’ah like the first, with two long rukoo’s and two long sujoods, as he did in the first rak’ah. Then he should recite the Tashahhud and say the salaam.
It is sunnah to pray Salaat al-Kusoof in jamaa’ah (congregation), because this is what the Prophet SAWS (peace and blessings of Allaah be upon him) did, but it is permissible to pray it individually, as with all other naafil prayers. However, praying it in congregation is better.
It is sunnah for the imaam to address the people after the prayer, and to warn them against negligence and being led astray, and to tell them to make lots of du’aa’ and ask for forgiveness.
If the prayer ends before the eclipse does, then remember Allaah (dhikr) and call on Him (du’aa’) until the eclipse ends. The prayer should not be repeated. If the eclipse ends before the prayer, then the prayer should be completed quickly, but it should not be stopped or cut off abruptly, because Allaah says (interpretation of the meaning): “and render not vain your deeds” [Muhammad 47:33]. The prayer should be at the time of the eclipse, because the Prophet SAWS (peace and blessings of Allaah be upon him) said: “… until it (the eclipse) is over…” and he also said, “… until what you are going through is over …”
Shaykh al-Islam Ibn Taymiyah said: “Sometimes eclipses last for a long time, and sometimes for a short time, depending on how much of the sun or moon is eclipsed. The entire sun or moon may be eclipsed, or only half of it, or one-third. If it is a total eclipse, then the prayer should last long enough for all of al-Baqarah or something of similar length to be recited in the first rak’ah, and in the next rak’ah a shorter recitation is made. There are saheeh ahaadeeth narrated from the Prophet SAWS (peace and blessings of Allaah be upon him), as we have mentioned, and it is prescribed to shorten the prayer if the reason for it [i.e., the eclipse] is no longer there. So if it is known that the eclipse will not last for long, or if it started to get less, one should still pray, but the prayer should be shortened. This is the opinion of the majority of scholars, because this prayer is prescribed for a specific reason, and if the reason is no longer there and the eclipse is over, one should not pray.”
Taken from IslamQA