They probably just hold it.
Without sounding to graphic...its MUCH easier to hold back poop then pee, if you really put your mind to it.
The standard method has been "piddle packs," a plastic bag with gel/sponge materiel inside. Female pilots had to use diapers.
There's a newer system in the US for both male and female pilots called the "AMXD" (Advanced Mission Extender Device). It uses a hose for men and special underwear with a funnel for women to collect urine.
Yea that's the system they use to pee...but I'm talking about taking a dump!
Fighter missions don't last long enough for the pilots to have a need to drop a deuce... 6 hours at the very most with refueling or extra tanks for a no-fly-zone patrol... most sorties are considerably shorter because the planes will have expended their munitions in a very short timespan. Flying a fighter is extremely stressful on the human body so the military prefers to keep their pilots up there for only as long as is necessary.
Bombers, on the other hand, can run missions lasting 24 hours or more. I am reminded of some B-2 Spirit sorties over Iraq... the flights launched from the USA, refueled over the atlantic, hit their targets in enemy territory, turned around, refueled again over the atlantic, and returned to their bases in the USA. This is why bombers have a 2-4 man crew and have small bunks for eating/sleeping and a lavatory behind the cockpit.
With the numbers of fighter sorties flown throughout history, I'm sure it happened to someone sometime... but I haven't seen any stories circulated anywhere.