What we have now in America is a system that is volunteer or conscript (commit a crime and you may be given the option to join the military or do prison time). This takes advantage of the poorest and most vulnerable in our society.
I am generally for the idea of mandatory service. But the actuality as I experienced military service is not something I would wish on other people. The military is kind of broken in many ways.
Suicide rates are higher than the national average.
Rapes/sexual assaults are higher than the national average.
They have a blind spot where mental healthcare is concerned.
Leadership often employs and elevates people who will actively take advantage of their position. This is often detrimental to the members who serve under them.
The military often does a horrible job of allowing injured people the time and conditions to fully heal.
The military also treats everyone as if they lack common sense and the ability to reason. As a result it does not promote the type of people who think outside the box. There's multiple ways that military service infantalizes its members instead of treating them like adults.
There are many reasons I think it could be a good idea and a good experience for the vast majority of people. But not as it is now. The system would need an overhaul.