(Glory to ALLAAH)
(I) In general looking hither to thither is highly taboo because of following ahadith
(a)Narrated ‘Aishah(may ALLAAH be pleased with her) I asked Allah’s Messenger(peace on him).about looking hither and thither in As-Salat (the prayer). He replied, “It is a way of stealing by which Satan takes away (a portion) from the Salat (prayer) of a person”
moreover our eyes should be only towards point of sujood (prostration) and our concentration should be only on Salat so much so that the clothes which we wear if they have any designs which diverts our concentration then it must also be changed.
(b)Narrated ‘Aishah (may ALLAAH be pleased with her) Once the Prophet offered Salat (prayer) while wearing a Khamisa (a woollen square blanket) with marks on it. Then he , said, “The marks on this (Khamisa) have diverted my attention, take it to Abu Jahm and bring an Inbijaniya (a plain sheet) (from him.)”
Saheeh Bukharin 752
(II) But it is permissible to look hither to thither only in a necessary suitations
(a) Narrated lbn ‘Umar(may ALLAAH be pleased with him) The Prophet (peace on him) saw expectoration in the direction of the Qiblah of the mosque while he was leading As-Salãt (the prayer), and scratched it off. After finishing the Salãt (prayer), he said, “Whenever any of you is in Salat (prayer) he should know that Allah is in front of him. So none should spit in front of him during the Salat (prayer) .
Saheeh Bukhari 753
In the above hadith prophet (peace on him) saw the expectoration which is in the direction of Qibla & he immediately moved from his place of prayer and scratched it and came back and lead the people in prayer. Messenger (peace on him) saw this expectoration whilst in prayer because it was necessary circumstance that it(expectoration) should not be in mosque hence as he said “So none should spit in front of him during the Salat (prayer) .”
(b) Narrated Anas : While the Muslims were offering the Fajr prayer, Allah’s Messenger (peace on him) suddenly appeared before them by lifting the curtain of the dwelling place of ‘Aishah, and looked towards the Muslims who were standing in rows. He smiled with pleasure. Abu Bakr started retreating to join the row on the assumption that the Prophet wanted to come out for As-Salat (the prayer). The Muslims intended to leave As-Salat (and were on the verge of being put to trial), but the Prophet beckoned them to complete their salat (prayers) and then he let the curtain fall. He died in the last hours of that day.
Saheeh Bukhari 754
In this hadith Abu Bakr & Muslims (may ALLAAH be pleased with them) saw prophet(peace on him) whilst in Salat they wanted to see Messenger of ALLAAH (peace on him) because he was in fatal illness and at the verge of death. Muslims were terrified that they might not be able see him anymore, they were in search of opportunity to see him as a result “when prophet (peace on him) lifted the curtain to see Muslims, they also saw him while they were in prayer” .
ALLAAH knows best