Impersonating any officer including a military officer is illegal and if and when caught you could face some prison time or at least some jail time as well as a fine of $5,000.00 or more.
The penalty for impersonating a military officer or any officer depends on the local laws and what you actually did when impersonating the officer.
If all you did was impersonate the officer such as claim to be a military officer and someone didn't believe you and turned you in then you would be arrested or fined.
Then you would have to go to court and then possibly face fines and even a year in jail or even more.
If you actually made an arrest as an officer including a military officer then you could serve a more lengthy prison sentence.
If you want to be an officer including a military officer you need to go through the proper training and and get legally hired and sworn in.
Impersonating an officer including a military officer can hurt your chances of ever becoming an officer in the first place.