What may not be done during Prayer and what is permitted - Section 2 Mishkat al-Masabih 998

Arabic hadith text
وَعَنِ ابْنِ عَبَّاسٍ رَضِيَ اللَّهُ عَنْهُمَا قَالَ: إِنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ كَانَ يَلْحَظُ فِي الصَّلَاةِ يَمِينًا وَشِمَالًا وَلَا يَلْوِي عُنُقَهُ خَلْفَ ظَهْرِهِ. رَوَاهُ التِّرْمِذِيُّ وَالنَّسَائِيُّ
Translation

Ibn ‘Abbas said that God’s Messenger used to glance right and left during prayer but did not turn his neck to look behind him. Tirmidhi and Nasa’i transmitted it.