I had to take months off from exercise this past year after a back injury. I mean off of everything. Couldn't even stretch except PT moves. Slow walking only. No lifting anything. I was really worried about gaining weight, but it actually ended up that I lost about 5 pounds. I just had no appetite, probably from all the pain and also from the decrease in calorie expenditure.
I also felt awful, of course. I'd rather be doing the cardio and eating and gain a few pounds than feel like that again. Happy to say it's almost all the way better and I can work out with modifications now.