The Prophet ﷺ said, "Allah continues to face His servant during his prayer as long as he does not turn away. But when he turns away, Allah turns away from him."
عن النبي ﷺ قال: لا يزال الله عز وجل مقبلا على العبد وهو في صلاته ما لم يلتفت فإذا التفت انصرف عنه.
Reported by Abu Dawud (909) and Nasai (1195), both from Yunus, from Zuhri, who said, "I heard Abu Ahwas narrating to us in the gathering of Saeed bin Musayab, while Ibn Musayab was sitting there, that he heard Abu Dharr saying," and then he related the hadith. This same route was also reported by Darimi (1429), and Ibn Khuzayma graded it sahih (481, 482), as did Hakim (1/236), who said, "Sahih in isnad, though the two of them [Bukhari and Muslim] did not include it. This Abu Ahwas is the freedman of Banu Layth, a successor from the people of Madinah. Zuhri considered him trustworthy and narrated from him, and there was a debate between him and Saad bin Ibrahim regarding this matter." Some criticism has been directed at Abu Ahwas, but nevertheless his hadith is hasan.On this subject there is also a narration from Abu Hurairah, reported by Imam Ahmad (7595), which contains Yazid bin Abu Ziyad Hashimi, who is daif, and his teacher is unknown. It was also reported by Abu Yaala (2611), which contains Muhammad bin Ubaydullah Arzami, who is discarded as a narrator.On this subject there is also a narration from Muaz bin Anas, from the Messenger of Allah ﷺ, "Laughing during prayer, turning one's head, and cracking one's fingers are all of the same status." This was reported by Imam Ahmad (15621) and by Tabarani in al-Kabir (20/189-190), both from Ibn Lahia, from Zabban bin Fayd, from Sahl bin Muaz bin Anas, from his father, who then related the hadith. The isnad contains Ibn Lahia, who is daif, and his teacher Zabban bin Fayd Basri, Abu Juwayn. Ibn Main said of him, "A daif teacher." Imam Ahmad said, "His hadiths are objectionable." Ibn Hibban said, "Extremely objectionable in his hadith."It was also reported by Tabarani in al-Kabir (20/190) through the route of Rushdin bin Saad, and by Bayhaqi (2/289) through the route of Layth bin Saad, both of them from Zabban, with the same wording. Bayhaqi said, "Zabban bin Fayd is not strong."There are other hadiths on the subject of the dislike of turning one's head during prayer, but none of them are sahih except what I have mentioned.