Pinhole glasses have hundreds of tiny holes that restrict the light entering your eyes, effectively shielding your vision from indirect rays of light. The pinhole glasses limit the light from an overpowering mass of light rays to a collection of lower-intensity, distinct light rays that effectively give your eyes a more "organized" pattern on which to focus. This causes the ciliary body of your eyes to engage in adaptive exercise which helps support the range of motion of your ciliary muscles (focusing muscles).
Those muscles control the shape of your lenses that focus light inside your eyes. As these muscles become stronger (over a period of days and weeks), they become more "fit," just like resistance exercises make your body muscles more capable over time. (Increases in range of motion are everything when it comes to controlling the shape of the lenses in your eyes.)
The end result? With naturally enhanced fitness, your eyes see more clearly.