You're not just going out there maybe sacrificing your own life. There's also sacrifices still going on at home. You can serve in the military and have a good marriage but you just need to be aware of it so you can take those steps to take care of it.
It can have a secular purpose and have a relationship to God because God was presumed to be both over the state and the church and separation of church and state was never meant to separate God from government.