The horizontal slit pupil widens the field of view along the ground plane while limiting light from overhead, sharpening the image of the horizon where a predator would appear. Modelling of ungulate eyes indicates this shape improves depth information for objects ahead and reduces glare from the sky, at some cost to vertical acuity.
The rotation is the striking part. When a grazing animal pitches its head down through a large angle, the eyes counter-rotate, in goats and sheep by up to roughly fifty degrees per eye. The pupil therefore remains close to horizontal regardless of head position. The movement, called cyclovergence, is visible if a goat's eye is watched as it lowers its muzzle.
The pattern is not a goat peculiarity. Horizontal slit pupils occur broadly across grazing prey animals, while vertical slits are typical of ambush predators that hunt close to the ground. Pupil shape in this framework tracks ecological niche rather than taxonomy, which is why goats and sheep share it with horses and not with cats.

