It's not rare for people to double-dip: do your 20 in the military, then go work as a teacher or DOD civilian or something that'll give you a second pension.
If you don't blow all your expendable income on a sports car financed at 30% APR, it's also possible to build up a good nest egg by the time you retire. You can also take advantage of other veterans benefits. A friend of mine got more money from his GI bill benefits (tuition + stipend) than from the actual salary he made during his army years.
Quick edit: the military has a mishmash of different retirement plans depending on when you signed up. I think the most recent one is more defined contribution focused and makes it harder to get money before you're in your 60s
Or knock up a stripper, or lose half your net worth when you divorce your dependa, or all the other bad life decisions that tend to plague people in that line of work.
If you can get through the first 4yr unscathed you're probably on a good path.
So, for anyone just chasing DoD pensions and GI bill benefits, make sure you end up as a lithographer or some shit.
https://www.benning.army.mil/garrison/dhr/content/PDF/ALARAC...
As I understand it, the flipside of this was that not very many people in his (very early) cohort survived, in case someone is thinking of this as "easy government money".
Edit: if you're super ambitious, you take the skills from your military specialization (pilot, nuke engineer, etc) to the civilian world and work another 20 years. you're now 58 which is still younger than the typical 65 for retirement, but now on 2 pensions or 1 gov't pension plus a really nice portfolio.
Then - the corps (corporations) come looking for you.
If you join now there is an age it kicks in I think, rather than immediate.
Plus you still have access to things like the commissary if you live near a base. As well as medical insurance for life.