Katniss herself explains this in the last paragraph of chapter 27. When Katniss returns to District 12, Gale is not longer there. She asks Greasy Sae where he went and is surprised at her own reaction when she finds out he was assigned to District Two.
"I dig around inside myself trying to register anger, hatred, longing. I find only relief." (pg 384)
She is not taking care of herself at this time, basically living in solitary confinement until the day when she sees Peeta digging in her garden. Peeta is a very sensitive person, and he has gone out and found primrose bushes to plant around her house in memory of her sister. This encounter inspires her to clean up and start living again. She and Peeta are both back in district 12. They spend a lot of time together. He really loves her and she says,
"Peeta and I grow back together......On the night I feel that thing again, the hunger that overtook me on the beach, I know this would have happened anyway. That what I need to survive is not Gale's fire, kindled with rage and hatred. I have plenty of fire myself. What I need is the dandelion in destruction. The promise that life can go one, no matter how bad our losses. That it can be good again. And only Peeta can give me that."
So, after, when he whispers, 'You love me. Real or not real?'
I tell him 'Real.' " (pg 388)
She chooses Peeta. It is not a forced marriage. She needs Peeta's love and support.
She loves Peeta. When Gale was assigned to District 2 in the 3rd book she thinks she should have anger or sadness but she is relieved and she loved Peeta as much as he has loved her all this time. In the third book when Peeta is turned against her you can see how much pain she is in and how much she loves Peeta as well. Soon her friendship from the Games with him turned into love.