It was narrated that Qabisah bin Mukhariq Al-Hilali said:
There was an eclipse of the sun and at the time we were with the Messenger of Allah (ﷺ) in Al-Madinah. He rushed out dragging his garment and prayed two rak'ahs, which he made lengthy. The end of his prayer coincided with the end of the eclipse. He praised and glorified Allah (SWT), then he said: 'The sun and the moon are two of the signs of Allah (SWT), and they do not become eclipsed for the death or birth of anyone. If you see anything of that, then pray like the last obligatory prayer you did before that.'