[A humble request: If you can, please donate to help me carry on tracing word histories. Thank you.]
The colloquial phrase anything in trousers, and its variants, mean: any man.
This phrase often occurs in contexts in which a person—especially a woman—is disparagingly characterised as sexually promiscuous or indiscriminate.
The following, for example, is from Bank Holiday Weekend highlights, published in the Worcester Evening News (Worcester, Worcestershire, England) of Saturday 2nd May 1998 [page 14, column 4]:
CARRY ON EMMANUELLE (1978): Kenneth Williams and the usual team. A sexy French Ambassador’s wife attempts to seduce anything in trousers. Suzanne Danielle is the fine filly determined to get her claws in every passing gent. With Kenneth Connor and Joan Sims. (CENTRAL, 11.45 pm)
—Cf. also the phrase to be all mouth and (no) trousers.
These are, in chronological order, the earliest occurrences of the phrase anything in trousers and variants that I have found:
1-: From a transcript of the lecture, entitled Fair Play for Woman, that the U.S. author and social reformer George William Curtis (1824-1892) gave at Mozart Hall, New York City, on Thursday 8th April 1858, published in the New-York Daily Tribune (New-York City, New York, USA) of Friday 9th April 1858 [page 5, column 5]:
The whole theory of modern society is the Cochin-China proverb, that “women’s hearts bear a good deal of breaking.” It is not changed so very much. Women are sold by parents from Circassia, and they mean by the sale precisely the same as the fashionable woman now means when she calls a good match for her darling Jane anything in trowsers with twenty thousand a year.
2-: From Hyacinthe’s Wife, published in the Omaha Daily Bee (Omaha, Nebraska, USA) of Tuesday 3rd December 1872 [page 3, column 3]:
Flippant paragraphists have been very reckless in their mention of Pere Hyacinthe, especially in America, and the public naturally felt that the Pere had done something wonderfully silly. The origin of this style of treatment was the result of a Paris letter which represented Mrs. Merriman as one of the proverbial widows who weave their wiles over anything that wears trousers, and are determined to have a successor to the immaculate and always tender first, at whatever cost.
3-: From “Auld Robin Gray”, by the British author Mary Rose Godfrey (1842-1888), published in Temple Bar: A London Magazine for Town and Country Readers (London, England) of March 1879 [page 412]:
There is a mediæval young lady with sentimental eyes, a symphony in grey after Whistler; and a mediæval young man who is as like her as anything in trousers can be like anything in petticoats.
4-: From The Evening News (St. Joseph, Missouri, USA) of Thursday 13th May 1880 [page 1, column 5]:
That champion, marry-as-you-please fellow, Clarence E. Davis, of Chicago, is not going to the Joilet prison simply as a punishment for bigamy. He will be jailed so as to keep him out of the way of silly women who are so hungry for marriage as to wed men of whom they know nothing, and who will take a murderer, a thief—in fact anything in trousers—in order to have a husband. Mr. Davis must be protected even if society has to shelter him behind the walls of the penitentiary.
5-: From Life’s Ups and Downs, published in The Janesville Weekly Gazette (Janesville, Wisconsin, USA) of Thursday 16th June 1881 [page 4, column 5]:
There was a well on the place, which was all well enough, except that some boards had fallen in, which interferred [sic] with the buckets working well. Well, the good lady, inspired by the enthusiastic independence of Susan B., and other of the revolutionary forefathers, concluded she wouldn’t wait for the old man to come home. She’d show that she could manage the place as well as anything that wore trousers.