I've never been in the military and I compartmentalize. I do so in order to work. Many times therapists will have you imagine a box with thoughts and memories at the bottom of the ocean or top of a moutian. Same thing. I just don't have to do all of that. I do it automaticlly. How? Well, I grew up in a cult and at 19, BAM, had to work and be in the world to support myself. I had no other choice. Compartmentalizing just happened and today it works the same way. My therapist has to help me pull them out of the mental boxes but I am doing better at doing it on my own, but it happens automaticlly. But mental boxes that never get touched = denial. It's a fine line I suppose. Was there too for 10 yrs before therapy. So, I guess I can say the mental boxes were automatic and 19 and stayed locked and untouched until I went to therapy at 28 (9.8 ish yrs but easier to say 10). But you have to pull the junk out of the mental boxes in therapy.
Where did I hear the term. Ah, around. Asking people. Googling. My therapist. Here. Etc.
ETA: I imagine it probably happens the same way for military. They are in a warzone and then BAM, they aren't and are home in the "family life".