In fact, batters used to do this on purpose. First, batters often hit baseballs that then bounce from fair territory into foul territory (and vice-versa, which is much less frequent).
Under the original rules he was allowed to try to advance around the bases as long as the batted baseball touched fair territory sooner or later. Start by considering the batter standing at home plate trying to hit the pitched baseball into fair territory, which spreads out from him like a slice of pie.
To be precise-and this is not too much information for a basic look at baseball-we have to understand the terms fair ball and foul ball. The previous page gave a simple overview at what's good and bad for the offense.
What's good and bad depends on trajectory, not just territory