Stress puts the body into emergency mode, boosting strength, awareness, etc... to prepare for a fight or flight response. Less urgent processes like digestion can wait, and they are effectively put on halt to save energy for more pressing matters.
Of course, it is not good for the guts, but the consequences can be dealt with later, if we survived the stressful encounter.
It totally makes sense, but it can become a problem if fight or flight is not the appropriate response and stress lingers for longer than necessary, as it is all too common in modern human society.
Stress suppresses digestive system. Roughly speaking, it redirect energy from stomach into muscles. Instead of becoming sleepy and relaxed to digest food, the animal becomes focused and ready to run from a threat. This is an evolutionary mechanism to let the animal escape from a predator.
However, if the stress is permanent and never goes away, the digestive system become suppressed for way too long and gets damaged.
I’ve just finished reading "The Immune Mind" by Dr Monty Lyman, and I can recommend it if you’d like to dive deeper into how our mind, body and gut are all different parts of the same defense system. One imbalance in one area can affect the immune system overall. Very enlightening and made me took my chronic stress a lot more seriously.
Why do your lungs and stomach share the same passage? It's a product of evolution by natural selection. During an asthma attack, cortisone is administered to suppress the immune system. Interestingly, cortisone closely resembles cortisol, the body's natural stress hormone.