Stress has a strange relationship with our eating habits. According to the Harvard Medical School, short-term stress shuts down our desire to eat due to the release of a hormone called corticotropin. That, along with the release of epinephrine, kick-starts our fight-or-flight response and pushes aside anything that's going to get in the way of that, including our desire to eat.
Usually, our stress responses disappear when the stressor disappears. But if that stressor doesn't go away, our body reacts in a different way with the release of cortisol. Instead of suppressing every urge that's not considered vital to our immediate survival, cortisol increases our motivation. That, unfortunately, increases our motivation to eat, too, and the higher our cortisol levels get, the more motivated we are.
Even as cortisol is pushing us toward food, it's been found that we (that is, moreso women than men) tend to turn to certain types of food. We call them comfort foods, and they're the ones that are usually high in fat and sugar content. Biologically, comfort food is exactly that. Harvard suggests foods high in fat and sugar actually act on the brain to counteract some of the worst feelings of stress, providing a relief that's only temporary. In 2007, a British study also found that our tendency to eat and gain weight when we're stressed varies by the individual, too, as people who produce more cortisol are more likely to stress eat. Ultimately, prolonged stress grooms us to seek out food-related relief, and that compounds into weight gain — especially when combined with other effects of stress, like a lack of interest in exercise, insomnia, and a tendency to drink more alcohol when we do partake.