Basic plot is a galactic war between two factions, but that's backstory not the focus. The protagonist's side is human, I don't recall the enemy as they weren't really the focus of the story as I remember it. They might have been human as well.
The story starts with the protagonist having already been captured and is being sent to the prison planet, which is only populated by prisoners of war. His identity is kept vague to the reader. He's taken in by the existing prisoners, who have an established hierarchy based on their military rank before capture. I have a memory of forests and maybe tree houses, with that sort of 'wood based' technology, if you see what I mean. But it's vague and I could be mixing this up with another story. I think he is given a bit of a hard time initially, and the prisoners have essentially forgotten about the war. Then at the end of an early chapter it's revealed as a 'twist' that he's actually an Admiral (or some other equally high rank) and is in fact now the highest ranking prisoner on the planet and therefore assumes command. This twist is the thing that stands out most in my mind. He then knocks the prisoners into shape and I think orchestrates an escape and return to the war. I remember it as being reminiscent of WW2 PoW stories like Colditz, but it was a long time ago.
Pretty sure I read this as a paperback in the eighties, or maybe early nineties, and at the time I was reading a lot of second hand books that were written in the 60s and 70s. For the longest time I thought it was a Harry Harrison novel, as I read a lot of his work at that time, but having reviewed his work I can't find it. Might be a short story though as I haven't gone through all the possible collections.
Some additional thoughts. In the early stages where his identity is being kept from the reader, I think the character was quite despondent about being captured. After the reveal I think the dynamic was him being a great military leader, and getting the prisoners to remember they are soldiers and fight back lifts him out of his despondency.
When I talk about wood based tech, I basically mean boy scout type stuff as they don't have proper technology or metal in the prison. Hence tree houses, huts, or something like that.
A Planet Called Treason
by Orson Scott Card. It is also his first book, I believe.