system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why is it that we need to basically 'fast' for 24 hours before going into surgery?

I have always wondered how having very little food in your stomach affects a surgery.  I'm sure this concept is irrelevant in emergency surgery situations, so what are the implications?
gpt
Anesthesia can make you very nauseated, and they don't want you vomiting while you're unconscious.  Also, your organs "wake up" at different rates, and it's important that your digestive tract be able to engage in effective peristalsis to move food down the canal.  Otherwise, you'd have lumps of decomposing food in your digestive tract, constipation (another side effect of anesthesia), and bloating and cramps from the offgassing because the peristalsis wasn't squeezing it along.  Same thing goes with pets, which is why you have to withhold food and water for a time before surgery. It's a smaller consideration in emergency surgery, as you mentioned, but if you have the ability to prevent it, why not?