There are lots of excellent answers here addressing food and water safety, which is all very important. But prophylaxis can also help prevent serious illness, and prompt treatment if you feel unwell can vastly reduce the symptoms and duration of the illness and help stabilize things if you need to continue traveling. The US Centers for Disease Control's Yellow Book (Health Information for International Travel)—the bible of travel medicine—has a chapter on Travelers' Diarrhea that's well worth reading in full, including this section:
Nonantimicrobial Drugs for Prophylaxis
The primary agent studied for prevention of TD, other than
antimicrobial drugs, is bismuth subsalicylate (BSS), which is the
active ingredient in adult formulations of Pepto-Bismol and
Kaopectate. Studies from Mexico have shown that this agent (taken
daily as either 2 oz. of liquid or 2 chewable tablets 4 times per day)
reduces the incidence of TD by approximately 50%. BSS commonly causes
blackening of the tongue and stool and may cause nausea, constipation,
and rarely tinnitus.
Travelers with aspirin allergy, renal insufficiency, and gout, and
those taking anticoagulants, probenecid, or methotrexate should not
take BSS. In travelers taking aspirin or salicylates for other
reasons, the use of BSS may result in salicylate toxicity. BSS is not
generally recommended for children aged <12 years; however, some
clinicians use it off-label with caution to avoid administering BSS to
children aged ≤18 years with viral infections, such as varicella or
influenza, because of the risk for Reye syndrome. BSS is not
recommended for children aged <3 years or pregnant women. Studies have
not established the safety of BSS use for periods >3 weeks. Because of
the number of tablets required and the inconvenient dosing, BSS is not
commonly used as prophylaxis for TD.
The use of probiotics, such as Lactobacillus GG and Saccharomyces
boulardii, has been studied in the prevention of TD in small numbers
of people. Results are inconclusive, partially because standardized
preparations of these bacteria are not reliably available. Studies are
ongoing with prebiotics to prevent TD, but data are insufficient to
recommend their use. There have been anecdotal reports of beneficial
outcomes after using bovine colostrum as a daily prophylaxis agent for
TD. However, commercially sold preparations of bovine colostrum are
marketed as dietary supplements that are not Food and Drug
Administration (FDA) approved for medical indications. Because no data
from rigorous clinical trials demonstrate efficacy, there is
insufficient information to recommend the use of bovine colostrum to
prevent TD.
The chapter goes on to discuss prophylactic antibiotics ("at this time, prophylactic antibiotics should not be recommended for most travelers"), and most importantly: treatment options if you do get sick ("The risks associated with the use of prophylactic antibiotics should be weighed against the benefit of using prompt, early self-treatment with antibiotics when moderate to severe TD occurs, shortening the duration of illness to 6–24 hours in most cases"), including oral rehydration therapy, antimotility agents, and antibiotics.
This answer is, of course, not medical advice, but the CDC's recommendations are a great start for a conversation with your doctor, who can assess the risks and benefits of different medical approaches and their suitability to your medical history, or better yet, you can talk to a specialist at a travel health clinic if one is available to you. In other words, after discussing it with a doctor, you may want to consider a layered defense:
- Intake: Careful selection of food and drinks, avoiding ice and anything else related to tap water, handwashing before eating, etc...
- Prophylaxis: Consider prophylactic Pepto-Bismol/Bismuth subsalicylate if indicated by your doctor and not incompatible with other medical conditions you may have or other drugs you may be taken. 8 tablets/day is a lot to carry and take, but it may be worth it if you're going to a high risk area, getting sick would really derail your travel plans, or you know you're particularly prone to TD while traveling.
- Treatment: Carry a range of medications to deal with the problem if you do get sick. Over-the-counter antidiarrheal medications can start working quickly, and your doctor may consider it appropriate to prescribe antibiotics to bring with you in case you need them (if this is the case, you should naturally follow all the instructions and take the entire course of antibiotics as directed if you've been given more than one dose). Being prepared can significantly reduce the amount of time you're sick and limit the disruption to your trip, and it's far easier than trying to track down the medicine you need in a foreign country while you're feeling horrible.