I would like to know what "He told me how he’d been in the war" means in the following sentences:
I wanted to run home straight away, knew I had to get away from this place, and remembered Granny, who’d already be worried to death. But I didn’t. Because after I had released myself in this stranger’s mouth, it almost felt like I no longer had a home. So, after he had finished with a low grunt and we’d zipped up, we returned to the bench, where we had met on the other side of my life, and began to talk, our barriers suddenly removed. He unwrapped story after story, and I kept asking him questions, feeling it was my duty to learn. He told me about his first time, in the forest with a farmer from his village. He told me how he’d been in the war and how he’d almost died, and how he’d been raped by Russian soldiers in a prison camp. I nodded and said I was sorry, and made myself feel nothing. I couldn’t allow his pain to penetrate me.
In this novel which is set in the 1980's in Poland under the socialist regime, where homosexuality was socially unacceptable, the protagonist Ludwik (a university graduate) left Poland in 1981 to live in the United States of America. And he remembers what it was like back then in Poland, where he, who was a teenager unable to suppress his desire towards men, once went to the Staromiejski Park in Wroclaw, which was famous for the place where "inverts" went. There he met an old man (who looked like he could have been Ludwik's father), and engaged with him in a sexual intercourse. After that, they began to talk with each other. The old man told Ludwik how he had been in the "war".
In this part, I wonder whether this "war" means the Second World War, or some other war that I couldn't guess. And, would it be alright to understand that "was in the war" means "participated in the war as a soldier"?
I am an English learner from South Korea, so thank you for your patience in advance as I may not know obvious things. I would very much appreciate your help. :)