Does anyone know how they filled the cast for all the storm troopers in the original trilogy (IV, V, VI) movies. Did they get them from military volunteers?
In actuality, there's probably only about a dozen or so actors used for Stormtroopers (lots of actors are reused, like Jeremy Bulloch appearing in ESB as both Boba Fett and an unmasked Imperial Officer)
Most of the vast legions of Stormtroopers are created utilizing matte paintings.
A matte painting is a painted representation of a landscape, set, or distant location that allows filmmakers to create the illusion of an environment that is nonexistent in real life or would otherwise be too expensive or impossible to build or visit. Historically, matte painters and film technicians have used various techniques to combine a matte-painted image with live-action footage. At its best, depending on the skill levels of the artists and technicians, the effect is "seamless" and creates environments that would otherwise be impossible to film.
Here is one in-progress
Here is a finished one. If you look closely, you can see a "black" area near the shuttle. That's a clear spot on the glass where the live action would be filmed through. Watch closely in scenes where there are large groups of troops, and you'll notice that only those closest to the action ever actually move. That's because they're the only ones that were real actors.
Norman Dawn developed a technique that joined together a Photograph and a Painting to enhance the environment that is being shot by the camera (Wikipedia). Dawn, a photographer himself, took his photos and paintings and placed them on a large sheet of glass. Black tape was then placed over the parts of the camera where the painting would go. After the camera was positioned properly the live action scene would take place. What resulted was a union between a simple painting and actual live scenery.
Did you really think they built a village in the trees?
Not specifically Star Wars, but a great example of the steps involved in using a matte painting
Here is an artist setting up the camera so that it only films the live-action portions of the scene
Here is a great example of what is filmed actually filmed versus the final shot
Let's put it all together to see what it looks like.
As for how the actual troopers/actors did get cast...
I haven't actually read anything from an actual Stormtrooper, but based on what I have read and heard, I imagine it was the typical process for being cast as an non-featured role: know someone or get the job through the standard extra casting process.
Jeremy Bulloch said in an interview:
Did you have to audition for Boba Fett?
No, I’ve said before, if I hadn’t fit in the outfit, I wouldn’t have played the part. There was only one costume. My half-brother, Robert Watts, was an associate producer and he said, “Look, get your agent on to this. It’s not very much, but you never know.” So I went back and put the outfit on. And that was the interview with producer Gary Kurtz, putting bits of the outfit on and it fit like a glove. I always say to people, “It was meant to be.”
Having gone through the extra-casting process myself in the past, typically casting agencies are provided general descriptions of roles/groups they're looking for. Each candidate either provides a few basic photos, or comes in for them (as I had to). Those who fit the descriptions may be called in for fittings or readings if necessary. In my case, I was chosen solely on my appearance since it was for "deep background" where I would only be yelling and looking angry (for Pirates of the Caribbean 2 and 3).
For roles like Storm Troopers and most Rebels, a similar process would have occurred.
As per phantom42's answer, this was the days just before CGI, so there were a few live actors composited onto small live-action windows in matte paintings by these painters:
Empire Strikes Back: Harrison Ellenshaw, Ralph McQuarrie, Mike Pangrazio
Return of the Jedi: Mike Pangrazio, Chris Evans, Frank Ordaz
In addittion to matte paintings, cardboard figures were also used, notably in the hangar scenes in Return and the ceremony at Yavin.
If you have the old editions, you see this if you look for it, but I'm pretty sure this was replaced in the newer, more CG versions.
Edit: Here is a link to two photos from the award ceremony at forum.blu-ray.com. However, it is easier to see in the film as the cardboard cutouts are 100% stationary whilst live actors usually move somewhat no matter how still they should be (and CG characters usually move more unnaturally).