Google on pin-hole camera for an explanation of the optical effect. Pin-hole cameras are slow because they let very little light through, and the images they make are a bit soft.
As for your eyes, by restricting the angle of incidence in incoming light (looking through a pin-hole) you're minimizing the errors in your eyes' lenses. You may have noticed that when the light is dim and your pupils dilate as a result, your vision gets even worse than in daylight. This is typical.
While reduced spherical aberrations play a role, a smaller aperture results in less blurring for objects that are not in focus. I hope this picture illustrates the effect clearly enough:
This is also why photographers use smaller apertures to get a larger depth of field, or large apertures for a narrow depth of field.