Great question — answering as the UphillTech team:
Let's approximate the size of the Hidden Leaf based on the size of the Nine-tails in his attack: As you can see, the village is quite large. I can estimate a population of over 100,000 easily. Since many of them are shinobi, I don't think it's exaggerated to think that there are at least 12,000 shinobi there (probably more). So that's where all of them came from. Don't forget that we are focusing on only one (two) set of academy students as they progress, in reality there are new (and old) classes every year that graduate, get their own Jonin sensei, and take on missions etc. Those unimportant characters are often seen as what I like to call "shuriken throwers" (they only know how to throw...
Full answer by Madara's Ghost: https://anime.stackexchange.com/a/4110 (CC BY-SA 3.0).
Need it done for your business? UphillTech.
Looking for somewhere to watch it on TV? Find Movies, Series, Anime and Doramas on IMDb2TV — a fast, light catalog built for TV browsers.