'Abdullah bin 'Umar (may Allah be pleased with him) reports:
"In the time of Messenger of Allah ﷺ there once occurred a solar eclipse (According to the majority of the 'ulama this incident took place in the tenth year hijri). Messenger of Allah ﷺ went into the masjid, commenced salaah, and stood in qiyaam for so long that it was felt that he did not intend to perform the ruku'. (In another narration it is stated that he recited the Surah Baqarah.) He then performed such a long ruku as if he did not want to come up from the Ruku'. Then in the same manner after standing up from the ruku' he stood up for such a long time as if he did not want to perform sajdah, here too he kept his mubaarak head on the ground for such a long time as if he was not going to lift his mubaarak head. In this manner he did the same after lifting the head and sitting in jalsa, and after the jalsa in the second sajdah.In short, in every rukn of the salaah this was done, that every rukn was so long, as if this rukn was going to be performed till the end, and there is nothing after it. (In the same manner he performed the second rak'ah, and in the last sajdah), due to the intense fear he began taking heavy breaths and crying, and began pleading to the Almighty Allah that 'O Allah, it is only You that have promised that when these people make istighfaar there will be no punishment'. This saying of Messenger of Allah ﷺ refers to the aayah that is at the end of the ninth juz: ''But Allah would not punish them while thou was with them, nor will He punish them while they seek forgiveness. - Surah Al-Anfaal, 33.When Messenger of Allah ﷺ completed the salaah, the sun had cleared already. Messenger of Allah Sallahu 'Alayhi Wasallam delivered a sermon after this. After uttering the hamd and thanaa, he talked o this subject, that the sun and moon does not eclipse because of the death or birth of anyone, but both are from among the signs of Allah Ta'aala. (That gives His creation a warning so that they may fear Him). When the eclipses occurs then immediately turn towards Allah (begin istighfaar and performing salaah)"
حَدَّثَنَا قُتَيْبَةُ، قَالَ: حَدَّثَنَا جَرِيرٌ، عَنْ عَطَاءِ بْنِ السَّائِبِ، عَنْ أَبِيهِ، عَنْ عَبْدِ اللهِ بْنِ عَمْرٍو، قَالَ: انْكسفَتِ الشَّمْسُ يَوْمًا عَلَى عَهْدِ رَسُولِ اللهِ صلى الله عليه وسلم، فَقَامَ رَسُولُ اللهِ صلى الله عليه وسلم يُصَلِّي، حَتَّى لَمْ يَكَدْ يَرْكَعُ ثُمَّ رَكَعَ، فَلَمْ يَكَدْ يَرْفَعُ رَأْسَهُ، ثُمَّ رَفَعَ رَأْسَهُ، فَلَمْ يَكَدْ أَنْ يَسْجُدَ، ثُمَّ سَجَدَ فَلَمْ يَكَدْ أَنْ يَرْفَعَ رَأْسَهُ، ثُمَّ رَفَعَ رَأْسَهُ، فَلَمْ يَكَدْ أَنْ يَسْجُدَ، ثُمَّ سَجَدَ فَلَمْ يَكَدْ أَنْ يَرْفَعَ رَأْسَهُ، فَجَعَلَ يَنْفُخُ وَيَبْكِي، وَيَقُولُ: رَبِّ أَلَمْ تَعِدْنِي أَنْ لا تُعَذِّبَهُمْ وَأَنَا فِيهِمْ؟ رَبِّ أَلَمْ تَعِدْنِي أَنْ لا تُعَذِّبَهُمْ وَهُمْ يَسْتَغْفِرُونَ؟ وَنَحْنُ نَسْتَغْفِرُكَ فَلَمَّا صَلَّى رَكْعَتَيْنِ انْجَلَتِ الشَّمْسُ، فَقَامَ فَحَمِدَ اللَّهَ تَعَالَى، وَأَثْنَى عَلَيْهِ، ثُمَّ قَالَ: إِنَّ الشَّمْسَ وَالْقَمَرَ آيَتَانِ مِنْ آيَاتِ اللهِ لا يَنْكَسِفَانِ لِمَوْتِ أَحَدٍ وَلا لِحَيَاتِهِ، فَإِذَا انْكَسَفَا، فَافْزَعُوا إِلَى ذِكْرِ اللهِ تَعَالَى.