The correction would be to re-train yourself to keep your shoulder back. Reminders throughout the day like Post-it notes in common places may help to keep it on your mind.
Agree with RegJr. Making good upright posture is a habit. Over time, as you keep reiterating making or keeping yourself more upright, your body will respond and begin to understand that you are aware that you are slouching.
I am going to take an educated guess, (since I have no concrete statistics) but I would say that 99% of the men/women that are in the military, do not slouch much if at all. They don't do any muscle exercises per se, to learn this, they just begin to carry themselves more upright and or, for lack of a better word, at attention, or pay more attention to their posture or how they present themselves.
I used to slouch about 100 years ago. A guy told me to, walk around like you own the world. (well not a hard ass, but I think you get my meaning) Not only will/can it change your posture, but it can absolutely have an effect on your attitude and self esteem.
Pulling the shoulders back should help lengthen the pec etc. muscles and help the back/trap muscles tone up and shorten a bit over time.