In the interest of full disclosure, I’m an American army veteran.
The alternative to a volunteer force is conscription, which is unpopular and generally results in a lower quality force. And it can be a good career, at least in the U.S., particularly if you’re commissioned as an officer. It’s generally seen as a positive on your CV when you get out.
As to having “ a very good chance of being killed yourself”, only 20-25% of soldiers are considered front line war fighters. The percentage is even lower in the other services, particularly in the Air Force. And the number of deaths in service due to hostile action per year is very low, even during the post 9/11 period, when compared to the roughly 1.5 million active duty service members.
https://dcas.dmdc.osd.mil/dcas/app/summaryData/deaths/byYearManner
The number killed in accidents is consistently much higher.
While it’s certainly not for everyone, it is a good path for many.