Helen Czerski writes Behind the Spooky Eyes of Cats (‘Like scarier nighttime predators, cats have slit pupils that help them to judge distance and ambush their prey’):
Halloween is approaching, and a whiff of ghoulish menace is squatting casually in the darkness of London’s evenings. Ghostly figures, silhouettes of witches and jagged glowing teeth loom over me as I walk home, but it’s their eyes that I notice most: bright orbs watching me through a pupil that is often a dark vertical slit. That slit seems like a warning, a signal that whatever is behind it is out to get you. But owners of slit-shaped pupils aren’t rare in our world: Along with crocodiles and vipers, our cute fluffy pet cats all have them. So why are some eyes like this, and are they really the ones to be afraid of?
….
A cat—like its fellow nighttime predators—effectively has a narrow pupil in the horizontal direction but a wide pupil in the vertical direction. So anything along the horizontal plane is in beautiful sharp focus, and the image is more blurred in the vertical direction. But at the right focal length, the image will be perfectly in focus in both directions, and that gives the cat an extra way of judging distance.
An ambush predator needs to be absolutely perfect at distance measurements, because it only has one chance to pounce. The slit gives the cat a second way of doing this (the other is the stereo images from both eyes, which is how humans judge distance); the two complement each other to produce pinpoint accuracy.