The Messenger of Allah ﷺ said, "The sun and the moon are two of Allah's signs, by which Allah instills awe in His servants. They do not eclipse for the death of anyone. So when you see any of that, pray and call upon Allah until what has befallen you is removed."
قال رسول الله ﷺ: إن الشمس والقمر آيتان من آيات الله يخوف الله بهما عباده، وإنهما لا ينكسفان لموت أحد من الناس، فإذا رأيتم منها شيئا فصلوا وادعوا الله حتى يكشف ما بكم.
Bukhari narrated it in the Book of the Eclipse (1041), and Muslim in the Book of the Eclipse (911:21), both of them through a route from Ismail bin Abu Khalid, from Qays bin Abu Hazim, who said, "I heard Abu Masud say," then he related it. This is the wording of Muslim, and the wording of Bukhari is similar but abridged. Other hadiths about the eclipse prayer have also been mentioned, narrated by Ayesha, Abu Musa Ashari, Abdul-Rahman bin Samura, Jabir, and others.