Honestly this isn't something people select for at all--by the time you've made it through that many rounds of selection you aren't going to let GI issues keep you from the finish. I've heard of some creative solutions to the problem involving safing the ejection seat and getting out of your gear, but I don't really believe any of them. If you think it's a significant risk, you basically have two options: talk to the squadron flight surgeon and get medically grounded, or wear a diaper. Almost everyone is too proud to do either of those things, so a number of pilots have call signs related to shitting themselves in flight. Yes, everyone will make fun of you after the fact--if you're a decent person, you'll at least clean out the cockpit yourself.
I suppose you could avoid eating hours before a mission, and not eat gassy foods.