There was a study published this last year (2015) that suggests that the pupil style of an animal is related to its strategy for predation. This means that land animal pupils evolved as adaptations to the niche that they filled.
The study distinguishes between herbivorous, active, and ambush foraging behaviors. Ambush predators tend towards vertical pupils, where as active predators (those that chase down and kill their prey) tend more towards circular. The pupils of herbivorous foragers tended to be mostly horizontally-elongated as is the case with goats. Eyes also tend to be forward set in predatory animals and more at the side of the head in prey animals.
In Why do animal eyes have pupils of different shapes? Banks, et. al. Science Advances
07 Aug 2015: Vol. 1, no. 7, e1500391 DOI: 10.1126/sciadv.1500391 It is suggested that
Abstract
There is a striking correlation between terrestrial species’ pupil shape and ecological niche (that is, foraging mode and time of day they are active). Species with vertically elongated pupils are very likely to be ambush predators and active day and night. Species with horizontally elongated pupils are very likely to be prey and to have laterally placed eyes. Vertically elongated pupils create astigmatic depth of field such that images of vertical contours nearer or farther than the distance to which the eye is focused are sharp, whereas images of horizontal contours at different distances are blurred. This is advantageous for ambush predators to use stereopsis to estimate distances of vertical contours and defocus blur to estimate distances of horizontal contours. Horizontally elongated pupils create sharp images of horizontal contours ahead and behind, creating a horizontally panoramic view that facilitates detection of predators from various directions and forward locomotion across uneven terrain.

Figure 1. Why do animal eyes have pupils of different shapes? Banks, et. al. Science Advances
07 Aug 2015: Vol. 1, no. 7, e1500391 DOI: 10.1126/sciadv.1500391