Green’s Dictionary of Slang

do it v.2

to defecate or urinate.

[Ire]Joyce Ulysses 154: Before the huge high door of the Irish house of parliament a flock of pigeons flew. Their little frolic after meals. Who will we do it on? I pick the fellow in black. Here goes.
[UK](con. 1918) J. Hanley German Prisoner 33: ‘The last time I fell asleep I did it in my pants’.
[UK]L. Dunne Goodbye to The Hill (1966) 19: I was thinking I’d do it in my trousers if I wasn’t careful.
[Ire](con. c.1918) P. Crosbie Your Dinner’s Poured Out! 35: As very young children we [...] sang: ‘Mr. Dooley, / Done his pooley, / Up against his sister’s garden wall; / His sister caught him, / And smacked his bottom, / And poor ol’ Mr. Dooley done it all’.
[UK]A. Higgins Donkey’s Years 63: He had wet himself or done it in his pants.