From BR Bullpen
The foul pole is what demarcates whether a ball which passes above the outfield fence is fair or foul. While the foul pole is often indeed a pole rising from the corners of the outfield fence where it meets the left or right foul line, it can also be a narrow netting or a line painted on a structure.
The foul pole is entirely in fair territory. A ball which hits the foul pole is a home run, although there have been a few ballparks in the past where the pole was considered to be in foul territory according to the ground rules.
The purpose of the foul pole is to assist the umpire in determining whether a ball is fair or foul. This is especially important for a ball hit well over the fence, although there have been many cases of balls hit so high that the foul pole is of no help to the umpire. A famous instance happened at Stade Olympique in 1977, when slugger Dave Kingman hit a ball against the technical ring in left field, over a hundred feet above the fence. The ball was ruled foul, but the umpires instructed ground crews to paint a line on the ring to demarcate fair from foul territory before the next day's game.