All the above answers are very good, looking externally. Internally, I think that the military (Im speaking strictly in terms of America's military here) serves as the best government-funded social project we have. I would call it a "social project" moreso than a "job" because military service really goes beyond the boundaries of what we could consider normal employment. For example, a typical employment offer would list your wages, hours, and expected duties in easy-to-read print. You may have an employment interview which can last anywhere from an hour to a few days. Your enlistment contract will tell you the pay grade that you will come in at (from which you can determine what your wages are), and your job code (from which you can typically infer what your potential duties will be, in theory. We know that, in practice, the duties incurred by military service are far and above just that of your MOS). Your military employment interview goes on for weeks. In some MOS', it literally never ends. All similarities between the two essentially stop there.
But really, Im getting off-track. I've established that the military is so much more than a job. Internally, the benefits of military service are far and above any other social program the US offers.
-The new GI bill literally pays you to go to college
-Free medical and dental care for as long as you're in (and for some long-serving members, for life)
-Guaranteed retirement
-Free room, board, and meals (In the case of most enlisted. A housing allowance and meal stipend for others)
-Free travel (space-A)
-Professional job training. In some cases, extremely advanced training only available to certain sets of the private sector (Im looking at nuke technicians, SATCOM guys and the new CYBERCOM types specifically).
-The current state of the military-industrial complex (I know this is usually something of a slur, but I'll just use it for lack of a better term) means that a lot of vets can parlay their service and training knowledge into very high paying jobs almost as soon as they leave.
Then, of course, there's also the intangible effects of service: Discipline, physical fitness, pride, esprit de corps and a litany of other qualities you can attribute to serving.
What all this boils down to is that lots of vets get a killer deal for serving (if they take the opportunity to leverage their benefits), while America gets a strong national defense and contributes to the private sector through increased military R&D (The internet and GPS, for example, were defense projects before they hit the civilian market) and potentially more capable workforce (many companies prefer hiring vets because of the intangibles listed above). Meanwhile, vets can go to college without incurring the crippling debt that most civilians have to take on in order to afford a university degree these days. Vets with undergraduate degrees can also get advanced degrees at no cost to themselves. This allows for greater upward social mobility in our increasingly stratified society.
So really, having a standing military is a win for all those involved.