In the book, Jonas was able to feel pain and to feel the suffering of war because the Giver gave him those sorts of memories.
The first negative memory that the Giver gave Jonas was a painful one. It was a memory of a sunburn. That shows us how little real pain anyone ever felt in the community. Jonas had never felt anything that bad before.
Later on, the Giver gives Jonas the memory of a battle. Jonas occupies the memories of a young soldier who is dying in the battle. But after the soldier dies, Jonas continues to experience the horrors of the battle.