حَدَّثَنَا عَلِيُّ بْنُ عَبْدِ اللَّهِ، قَالَ أَخْبَرَنَا يَحْيَى بْنُ سَعِيدٍ، قَالَ حَدَّثَنَا ابْنُ أَبِي عَرُوبَةَ، قَالَ حَدَّثَنَا قَتَادَةُ، أَنَّ أَنَسَ بْنَ مَالِكٍ، حَدَّثَهُمْ قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم ‏‏ مَا بَالُ أَقْوَامٍ يَرْفَعُونَ أَبْصَارَهُمْ إِلَى السَّمَاءِ فِي صَلاَتِهِمْ ‏‌‏.‏ فَاشْتَدَّ قَوْلُهُ فِي ذَلِكَ حَتَّى قَالَ ‏‏ لَيَنْتَهُنَّ عَنْ ذَلِكَ أَوْ لَتُخْطَفَنَّ أَبْصَارُهُمْ ‏

Sayyiduna Anas ibn Malik – may Allah be pleased with him – narrated:

The Holy Prophet – may Allah send peace and blessings upon him – has stated:

“What is wrong with those people who look towards the sky during Salah?” His talk grew stern while delivering this speech and he said, “They must refrain from it; otherwise their eyesight would be taken away.”

(Sahih Bukhari Hadeeth No. 750, Sunan Abu Dawood Hadeeth No. 913, Sunan Nasa’i Hadeeth No. 1193, Sunan Ibn Majah Hadeeth No. 1044, Musannaf ibn Abi Shaibah Vol. 2 p. 240, Sunan Darimi Hadeeth No. 1302, Musnad Abi Ya’la Hadeeth No. 2918, Sunan Tirmidhi Hadeeth No. 3301, Musnad Ahmed Hadeeth No. 12426, Jami al-Masaneed of Imam Jawzy Hadeeth No. 363)

Commentary:

Imam Ibn Battal writes in his commentary that the jurists of all schools of thought consensually agree that it is Makruh to look up towards the sky in the state of Salah.

Imam Ibn Seereen – may Allah be pleased with him – said that the Holy Prophet – may Allah send peace and blessings upon him – used to look up towards the sky in the state of Salah until the following verse had not been revealed:

الَّذِیۡنَ ہُمْ فِیۡ صَلَاتِہِمْ خٰشِعُوۡنَ ۙ﴿۲﴾

  Those who beseech in their prayers.

(Al-Mu’minoon 23, Verse 2)

(Sharah Ibn Battal Vol. 2, p. 434)

Imam Badruddin ‘Aini also gave the same ruling in his commentary that it is consensually Makruh to do so.

Sayyiduna Ibn ‘Abbas – may Allah be pleased with him – said that whenever the Holy Prophet – may Allah send peace and blessings upon him – prayed Salah, he always kept his sight fixated on his place of Sajdah.

(‘Umdat al-Qari Vol. 5, p. 452-453)