When travelling, you will likely be introducing your body to food, drinks and water that it is unfamiliar with processing. Diarrhea is your body's response to these unfamiliarities. It is most often caused by the water so it is important to make sure it is safe to drink.
Check advisories about the local water and/or filter or purchase bottled water to try to avoid it. Eating in less sanitary conditions, from street vendors without refrigeration equipment for example, can increase your chances of acquiring it too.