Vision presumably came about from a biological system that was somewhat affected by photochemical interactions, which then evolved to be useful. That is to say, a living thing must have existed at some point that didn't have vision, but which was affected by light, such that more precise and useful light sensitivity evolved.