Ah, story advice. While your decision on such remains your own, I'll throw my own two cents into the ring here.
I'm going to be making a lot of assumptions here, though, since you've neglected to provide me with lots of information as to a reasonable solution. So, if things are a bit off base (or a lot), you'll have to excuse that due to the limited information you're presenting me with.
A governing body would never hesitate to put down someone clearly going against their rules (or in this case, religious teachings), unless the benefits FAR outweighed the drawbacks. Were it me, personally writing it, I'd have those benefits actually come with drawbacks for said character beyond mere "you're not holy enough, I'm going to taunt you forever!".
So, the possible benefits? Not anything like, "So dang good at their job" type situation. It would be more like, "seriously detrimental to morale to screw around with someone in the military who is likely very much loved by their men and who would likely be seen as a martyr for possible revolt". If this person in the military has commanded lots of troops and made a very good impression upon them, then it's likely not just "the church" that is turning a blind eye. It's likely the troops saved by this person in combat who turn the blind eye... The troops who were never put into unnecessary danger. The troops treated like an extended family or who have tight comradery with this soldier. Besides, just because an army works for a church, doesn't mean everyone in it follows its teachings... or enjoys how the church meddles in others' affairs. Some soldiers maybe just want to be paid, so they can eat, or raise their families. Soldiering is usually a profession unless you're indoctrinated into it from an early age. That means, people do it for the honor, the prestige... or just the money. Other benefits could include that having the people around who are "in love" is a way to demonstrate the possible mercy of a church (a little PR never hurt nobody, so long as that PR also comes with the lesson they're trying to teach). "Oh, sure, it's forbidden love they aren't allowed to have. Their love just emphasizes that people should take our teachings more seriously, or they could end up on the path to eternal heresy and being driven into being an outcast. We allow it in this one instance because we think they can be saved! We think you could teach them how to be saved, and also let them know how wrong their love is and that it should be given up for the sake of everyone!". You can spin-doctor it about a thousand ways. Depends on what your church actually believes and what its doctrines actually are.
Possible reasons they might also allow it is because maybe it was in return for a great deed. It was a request fulfilled with conditionals. "You can love this person, openly, in your own army, but you must still do your duty, and you can never have children with them (provided we're not dealing with a same-sex couple... if we are, you could probably insert something else like not receiving benefits if one should pass or you're not allowed to live together... Make something up). In return for stopping a plot against the most holy of holy people in the church, the favor granted was for the church to look the other way with whom said person loved.
As for why you're still in the army? Maybe it's your only marketable skill. Maybe the character doesn't have the brains to run a shop or be a scholar or something else. Maybe their only skill is in plying the trade of killing on a battlefield. Maybe should you or your partner quit the army, the favor no longer stands and you cannot be with them ever again. Maybe the church even puts you and your partner in combat very frequently in the hopes that one of you will die and they can finally dispense with their favor of letting things slide. They could spin the death as an act of whatever deity they worship. Maybe that guy rags on you so much, because he's not allowed to anything that makes the death look suspicious or purposeful. It has to look like the enemy killed you or your partner, and there can be no doubt that the army or your superiors tried to save you the best they could when it goes down.
There's honestly a lot of fun ways I'd handle it.
Heck, there might even be a way to handle it in which at the end, you realize the church was right and your union with said person actually brings forth lots of death and destruction... and you find out that you've been unwittingly playing a villain the whole time. It would definitely subvert expectations if you'd been painting the church as evil the whole time. If executed well, it might even be a fun plot twist.
That's my two cents.