Depth of field - also sometimes known as depth of focus (although that does has a different technical meaning - some people use that term) - is an area many photographers feel some confusion over.
By changing the aperture in the lens, you can make the resulting picture have more of the picture in focus from near to far, or you can limit the picture's focus on one place.
At ƒ1.8, the focus point will be much more defined with things in front of and behind the subject becoming softer looking the further from the subject they are. This is a very nice way to bring attention to the subject.
At ƒ22, the focus will seem to be sharp from very close to the camera to pretty much infinity. This is great for giving a sense of the place you shot the image, or for including many people in the image and keeping everyone clearly in focus.
However, there are limits to how that will appear in the final image.
Exercise: Find a subject/object that is still or will be in one place for a couple of minutes. Stand about 2 feet from the subject and focus on it. Set your ƒstop to 1.8 (or a close as possible to that based on the light) and set the shutter speed to get a proper exposure according to your meter. You can set the camera to Exposure Priority (AV mode) and let the camera set the shutter speed automatically. You should be using 50 mm lens or a zoom lens set to about 50 mm.
Now set your ƒstop to 16 and change the shutter as needed.
Step back to about 10 feet from your subject and re do the above settings - first at ƒ1.8 then at ƒ16.
To really push this exercise, try all the above steps with different lenses or at different lengths if you have a zoom lens - i.e.. try it at 35 mm and at 200mm, or whatever your zoom lens range is.
PS - a related subject is Bokeh which is a taken from a Japanese word 'bokeh' which roughly means blur or haze. When a photographer says an image has 'good bokeh' he means the out of focus areas have a smooth quality. Different lens and camera combination have different qualities of bokeh.