Sayyiduna Ibn Abbas (may Allah be pleased with them both) narrates that the Messenger of Allah (peace and blessings of Allah be upon him) used to glance to the right and left in his prayer, but he (peace be upon him) would not turn his neck backwards.
Hadith Referenceصحيح ابن خزيمه / جماع أبواب الأفعال المباحة فى الصلاة / 871
Explanation & Benefits
Shaykh Muhammad Farooq Rafi
Benefits: These hadiths are evidence that turning (iltifat) in prayer when needed is permissible, but this act is disliked and should be avoided as far as possible. The detailed discussion of turning has been given under hadith 285.
Source: Sahih Ibn Khuzaymah: Commentary by Muhammad Farooq Rafee, Page: 871