Short answer: they didn’t leave the theatre. The original Globe had no restrooms, no plumbing, and no designated facilities. During 2–3 hour performances, audience members—especially groundlings packed shoulder-to-shoulder in the yard—relieved themselves where they stood: in the aisles, under the galleries, even near the stage.
This wasn’t seen as outrageous at the time. Chamber pots were standard in homes; public spaces lacked facilities; the concept of a public restroom didn’t exist. The stench was simply part of the "groundling experience," referenced in contemporary accounts and satirical writings.
Wealthier patrons in the Lords’ Rooms or private boxes may have had servants bring chamber pots discreetly, but no dedicated facilities existed for any class. The theatre was a shared, crowded, olfactory-intense space—one more reason the "sweet smoke" of tobacco and herbs was popular.
Modern reconstructions (like Shakespeare’s Globe, 1997) discreetly include modern plumbing—thankfully.