At narrower/smaller apertures, the depth of field increases and objects that are further away are in focus.
As you raise the f-stop number through f/11, f/16, f/22 you are closing the aperture blades, resulting in less light being captured. At narrower/smaller apertures, the depth of field increases and objects that are further away are in focus.