Most of us don't fly long enough legs for it to be a major problem. Eat sensibly beforehand, go to the loo before you go, and land after a couple of hours for lunch and a break....hey, this is supposed to be fun!
But at the other end of the scale I remember Polly Vacher being asked during a talk what she did during her first round-the-world flight during the 16-hour leg over the Pacific. She gave an extremely funny account of getting out of her drysuit and many layers of clothes and using her plastic bottle thingy. I don't think anyone asked her about poo, but in the middle of the Pacific, when solo....needs must, and I'm sure she found a way.