I don't think most people join the military for the pension, so salary is probably more of a motivator.
I agree with Nords that most people don't join the military for the pension, but I think the promise of a good pension after 20 years of honorable service certainly influences people's decision to stay in past their initial commitment and make it a career...it certainly did for me. I originally joined the military because:
1) I wanted to serve
2) I wanted an education and did not have the money to pay for it and did not want to go into debt
3) I wanted to see the wider world outside of the small town in which I grew up
In my first 10 years of service, the Army provided me with a very good undergraduate and graduate education as well as a lot of specialized training, clearances and management experience. I have no doubt that with that education/training/experience I could have landed a good job in the private sector after my initial military commitment that would not require me to kill people who are actively trying to kill me and my coworkers, would not require me to live in close proximity to the aforementioned people, and would not require me to literally spend years away from my wife and kids in some of the more awful places on the planet. And in return for not having to do those things, I'd likely receive a 401k with a match.
I chose to stay in the military because:
1) I view the profession of arms to be a noble profession
2) I enjoy the high caliber of people with whom I work
3) there is a promise of a generous pension after 20 years of service
Although I didn't stay for the pension alone, it was a significant factor in my decision...I'm pretty sure that I could find another rewarding profession that had good people with which to work. The promise of a pension after 20 years of service is what convinced me to stay in the military and make it a career...without it, I would not have stayed in this line of work. I suspect that I'm not alone.