This is mostly to encourage more at bats to end with a ball in play.
Baseball is most exciting when a batter can put a ball in play.
It also gives the batter a slight advantage in that he can continue to foul pitches that he cannot achieve solid contact with and "keep himself alive.
"
This balances the pitcher's competitive advantage of knowing where the ball is going, how fast its traveling and what kind of pitch is being thrown.
In 0 and 1 strike counts the strike on a foul rule exists to advance the count and to speed up the game.
Advancing the count in this case serves to add drama and keeps the batter from engaging in a long series of foul offs with no consequence.
There are however 3 situations in which a foul ball can result in an out. with 2 strikes any foul bunt attempt will result in a strikeout.
with 2 strikes any foul tip that is caught by the catcher will result in a strikeout.
in any count a ball that is fouled and caught by a fielder is a foul out.
Basically the rule exists to foster more and better competition in the sport.
sports.stackexchange.com/users/6/wax eagle
Sorry, I don't have a reference for this, but we studied this in Game Theory: statistically matching the outcome of equal opponents.
When you match any two opponents of absolutely equal skill, the contest should end a stalemate (i.e. the rules should not give advantage to one over the other).
In baseball, if a hypothetically "perfect" pitcher could throw every pitch at the outside corner of the strike zone, it is very difficult to hit the ball in play.
Even the best batter is at a statistical disadvantage in that perfectly-matched contest.
So, they make it so the batter doesn't have to hit the ball in bounds to keep the engagement in play — they need only make contact with the ball to keep from being called out.
That "good enough to try again" rule keeps the competition in better balance without inadvertently giving advantage of one player over the other because of an unbalanced rule.
sports.stackexchange.com/users/2/Robert Cartaino
The MLB's Official Baseball Rules states in Rule 10.15: 10.15 STRIKEOUTS
A strikeout is a statistic credited to a pitcher and charged to a batter when the umpire calls three strikes on a batter, as set forth in this Rule 10.15.
(a)
The official scorer shall score a strikeout whenever a batter: is put out by a third strike caught by the catcher; is put out by a third strike not caught when there is a runner on first before two are out; becomes a runner because a third strike is not caught; or bunts foul on third strike, unless such bunt on third strike results in a foul fly caught by any fielder, in which case the official scorer shall not score a strikeout and shall credit the fielder who catches such foul fly with a putout.
In general, on any given at-bat the pitcher already has an advantage over hitters - on average a batter succeeds less than 40% of the time at the major league level.
As wax eagle notes, this rule gives the batter small advantage to stay alive.
sports.stackexchange.com/users/61/JW8
A foul ball is an intermediate result between a "strike" (a total miss) and a "fair ball" (one that goes into play).
Logically, a foul ball should be scored in an intermediate fashion between a strike and a fair ball as well.
One way of doing this is to count "half" strikes for a foul ball.
That would cause a certain amount of game confusion keeping track of these "half" strikes.
Another way of achieving a comparable, and equitable, result is to award the first two foul balls in an at bat as strikes to the pitcher, and the remaining ones as "free" shots to the batter.
In practice, it would mean that about half the foul balls are counted as strikes, and about half (after the second one) are not.
In theory, it means the that "burden of proof" is on the hitter to put the ball in play on the first two fouls, but for the third strike, the "burden of proof" is on the pitcher to get a "full" (not a foul, or "half") strike.
It's not unfair for the pitcher to have foul balls recorded as strikes, while the batter is not put out.
All contacted balls (plus called strikes) are strikes for the pitcher.
That includes "fair balls" that become hits, or outs, as well as foul balls, whether or not they become "strikes" for the batter.
sports.stackexchange.com/users/1738/Tom Au
The reason this rule exists is because in the early days of baseball, players would intentionally bunt foul to wear the opposing pitcher down.
A classic example of this is "King" Kelly of the Chicago White Stockings (precursor to our modern day Cubs).
King Kelly was notorious for bunting foul in order to wear down a pitcher and eventually get balls leading to a walk.
Back in those days, foul balls were not strikes.
The rules of baseball had to be changed because of this strategy.
For more information on King Kelly, read: https://en.wikipedia.org/wiki/King_Kelly
sports.stackexchange.com/users/12358/Jeff
From the  Wikipedia entry for foul ball   A strike is issued for the batter if he had fewer than two strikes ...A strike is, however, recorded for the pitcher for every foul ball thebatter hits, regardless of the count.   Why isn´t the batter struck out if he hits a foul ball while he already has two strikes? Why is this situation different than if he has zero or one strikes?
Why does a foul ball not count as a third strike?
sports.stackexchange.com
<rules><baseball>
sports.stackexchange.com/questions/119
sports.stackexchange.com/users/110/Fillet
Basically the rule exists to foster more and better competition in the sport. in the early days of baseball, players would intentionally bunt foul to wear the opposing pitcher down. Advancing the count in this case serves to add drama and keeps the batter from engaging in a long series of foul offs with no consequence.   This practice aims at engaging the ball more and adding drama and interest to the game. From a technical standpoint, a foul ball is not counted as a third strike as a means of giving the batter an advantage against the pitcher, who knows where the ball is headed, and preventing fouls. This practice fosters fair play and healthy competition. This statically balances the chances of two equal opponents in unequal positions.
This practice aims at engaging the ball more and adding drama and interest to the game. From a technical standpoint, a foul ball is not counted as a third strike as a means of giving the batter an advantage against the pitcher, who knows where the ball is headed, and preventing fouls. This practice fosters fair play and healthy competition. This statically balances the chances of two equal opponents in unequal positions.