Going to "see a man about a horse" - or "a dog" evolved from the 19th Century as an excuse to get out of an unpleasant situation. Before coming to mean "using the bathroom" it was also used at different times to refer to seeing a woman for sexual purposes, or even to mean going for a drink (during Prohibition).