Wikipedia actually has an article dedicated to this phrase. It says:
The earliest confirmed publication is the 1866 Dion Boucicault play Flying Scud in which a character knowingly breezes past a difficult situation saying, "Excuse me Mr. Quail, I can't stop; I've got to see a man about a dog." In a listing for a 1939 revival on the NBC Radio program America's Lost Plays, Time magazine observed that the phrase is the play's "claim to fame".
Wiktionary adds:
- The most common variation is to "see a man about a horse".
- Almost any noun can be substituted as a way of giving the hearer a hint about one's purpose in departing.
- The inversion to "see a dog about a man" eliminates any lingering uncertainty about whether the hearer is being put off.
- A shorter variant is to "see a man".
As to the exact situation in which you would use this phrase, it suggests:
Used as an excuse for leaving without giving the real reason (especially if the reason is to go to the toilet, or to have a drink)
Back to Wikipedia again,
During Prohibition in the United States, the phrase was most commonly used in relation to the consumption or purchase of alcoholic beverages.
World Wide Words has additional info:
This has been a useful (and usefully vague) excuse for absenting oneself from company for about 150 years, though the real reason for slipping away has not always been the same. [...] From other references at the time [around 1866] there were three possibilities: 1) [the speaker] needed to visit the loo [...] 2) he was in urgent need of a restorative drink, presumed alcoholic; or 3) he had a similarly urgent need to visit his mistress.
Of these reasons [...] the second became the most common sense during the Prohibition period. Now that society’s conventions have shifted to the point where none of these reasons need cause much remark, the utility of the phrase is greatly diminished and it is most often used in a facetious sense, if at all.
Various dictionaries have different things to say.
What price [fame/success/victory etc.]?
something that you say which means it is possible that the fame, success etc. that has been achieved was not worth all the suffering it has caused
What price victory when so many people have died to make it possible?
(Cambridge Idioms Dictionary, 2nd ed.)
price [...]
what price (something)? what are the chances of (something) happening now?
(Collins English Dictionary – Complete and Unabridged)
What price something?
What is the value of something?; What good is something? (Said when the value of the thing referred to is being diminished or ignored.)
Jane's best friend told us all about Jane's personal problems. What price friendship? Jack simply declared himself president of the political society. What price democracy?
(McGraw-Hill Dictionary of American Idioms and Phrasal Verbs)
what price ——? used to ask what has become of something or to suggest that something has or would become worthless : what price justice if he were allowed to go free?
(New Oxford American Dictionary 2nd edition, from OS X)
Apart from Collins's strange definition, it seems that the general meaning of "what price X?" is "what's the value of X?" (not "what's the price of X", in the modern sense of price).
As for how it came to be, my wild speculation of the day is that it could have been used grammatically in an anaphoric expression, eg What price is freedom to us if we tolerate this tyranny? What price justice? etc.
Best Answer
Actually the phrase predates Through the Looking Glass by at least thirty five years.
OED says
This leads me to conclude that it was a catchphrase before Carroll used it, and perhaps before Haliburton used it.