At home, meals, drinks, sleep and toilet visits happen at roughly the same times each day, and the bowel settles into that rhythm. On holiday, breakfast is late, lunch is in the car, water bottles get forgotten, and bedtime slides. The bowel loses its cues and slows down.
Food changes matter too: more snacks, less of the fruit and vegetables your child eats at home, and new things that may or may not agree with them. Long periods sitting in a car or on a plane reduce the movement that helps poop along.
Then there is the toilet. A hotel bathroom echoes, a campsite block is cold, grandma's toilet is tall and the flush is loud. A child who is only just comfortable pooping at home sees none of the things that make it feel safe, and holds.
A few days of holding can turn into a hard poop that hurts, which is the beginning of the pain and fear cycle. That is why it is worth acting from day one of a trip rather than waiting to see if things settle.