For perfect clear vision, the image needs to be focused onto the retina, just like a camera has to be focused properly in order to take a clear picture.
If the image is not focused exactly on the retina, then the image will be blurred, just like an out-of-focus photograph. In this case, the person is said to have a refractive error.
Refractive errors occur when there is a mismatch between the length of the eye, and its optical power. These mismatches usually originate during childhood, when the eyes are growing. The exact causes of refractive errors are still being studied, but it is known that both hereditary and environmental influences can affect their development.
Most people have some refractive error, but in most cases the error is small, and does not cause any problems. In fact, the average person is slightly long-sighted.