The foreground element should be the first thing that the viewer sees, with the middle ground being next. These two elements, when combined correctly, take the viewer's eye naturally to the background which provides a sense of depth and further interest to the viewer. When you carefully combine the foreground, middle ground, and background in a composition you will be creating a better photo. Get these elements right and you create an interesting photo, giving a 2D image a sense of depth.