You've received excellent information and advice here. The links provided should be very helpful.
As a person who has lived with IBD ( Crohn's Disease/Ulcerative Colitis) for about 40 years, I definitely can relate to your concerns. In spite of 2 surgeries and only having about 3 feet of colon, my IBD is well-controlled with a very expensive, not yet generic drug.
Essentially, I function normally. But I still take the smallest bottle of Pepto Bismol pills I can buy on every trip. Even people with normal guts can get out of sorts by the time change, different water (not bad, just different) or food that may be a little off. I've actually only used the Pepto twice in over 315 days of European travel since 2009, but I was sure glad I had it those 2 times.
Based on my experience, trains are not the major thing to worry about. Access to toilets on buses and when out and about can be a bigger issue.
Many have given advice as to how to deal with that. Mine is that anytime a toilet is available, use it! That's even if you don't think you need to. You never know if one will be nearby when you really, really need it.
Unlike Roberto, I eat yogurt every day to try to keep my gut happy, Greek at home, whatever's available in Europe. That might or might not work for you.
About the toilets themselves:
Although not so common these days, you could still occasionally encounter squat toilets. On my first trip to Europe in 1977, I always chose those because there was never any line. At 74 this month, my ability to use them is long past.
And I agree with the person up thread who prefers plain porcelain to any other option. It may not be as comfortable, but at least people don't line it, then not make sure that the liner flushes. Pet peeve here, in the US and Europe.