Foreshortening is strongly connected to linear perspective. In fact, most examples of linear perspective have examples of foreshortening, although they may be subtle examples. Foreshortening occurs when an object, or part of an object, appears shortened because of the vantage point that the artist is presenting. In this work by Caravaggio since David is holding out his arm towards the viewer his arm appears shorter. You can experience this by standing in front of a mirror and extending your arm out to the side. Now point it at the mirror. Notice that when you are pointing the length of your arm seems shortened. In this work by Canaletto the façades of the buildings on the left and right seem shortened as compared to the one that has its façade facing front.
Do not confuse this with objects that are not as tall (shorter) as that is an aspect of linear perspective.