The pinhole camera (and camera obscura) works by reflecting light off an object which is then focused onto a surface, creating an image of the object on the surface. Focusing would be via a lens in a modern camera, but in the pinhole camera it is the pinhole which focuses the rays of light.