Michael Curtis's answer makes the point that the pentatonic scale is what you get if you make a five-note scale by adding successive perfect fifths (and also makes the good point that this is not necessarily how the scale evolved). What I would add to that answer is that five notes is a natural stopping point in the process of adding perfect fifths.
If you start with a single note, F, and a single interval (the octave),
2
________________
| |
F F
then addition of the note a fifth above F gives C and subdivides the octave into two unequal intervals of a fifth (frequency ratio 3/2) and a fourth (frequency ratio 4/3):
3/2 4/3
________________ ____________
| | |
F C F
We've already added the fifth above F; if we now add the fifth above C we get G and the fifth between F and C gets subdivided into a major second (9/8) and a fourth:
9/8 4/3 4/3
____ ____________ ____________
| | | |
F G C F
Adding the fifth above G gives D, and subdivides the fourth separating C and F into a major second (9/8) and a minor third (32/27). If, instead of stopping there, we add the next fifth, A, both fourths get subdivided in the same way. In the resulting scale there are two intervals between consecutive notes: the major second (9/8) and the minor third (32/27):
9/8 9/8 32/27 9/8 32/27
____ ____ ________ ____ ________
| | | | | |
F G A C D F
Had we stopped at only four notes, there would be three unequal intervals separating consecutive notes of the scale.
We can stop here, but if we do continue adding fifths, the next point at which our scale has two unequal intervals rather than three is the seven-note scale:
256/243 256/243
9/8 9/8 9/8 | 9/8 9/8 |
____ ____ ____ ___ ____ ____ ___
| | | | | | | |
F G A B C D E F
The minor thirds of the pentatonic scale have been subdivided into a major second (9/8) and a minor second (256/243). (The stated frequency ratios are those of Pythagorean tuning, which, of course, is not what is actually used these days.)
The next such stopping point would be a 12-note scale. The five added notes would subdivide the minor seconds into two different types of semitone (ratios 256/243 and 2187/2048 in Pythagorean tuning). Note that the five added notes themselves form a pentatonic scale.
This answer is a somewhat abbreviated version of the related discussion here.