Moving the eyes to look to the side without turning the neck is legally prohibited and invalidates the prayer.

Disliked Acts in Prayer (مكروهات الصلاة) Part 1: Physical Actions