Pipe dream is US slang dating from the 1890s. It’s a reference to smoking opium and having fantastic hallucinations. From the Chicago Daily Tribune of 11 December 1890:
It [flying] has been regarded as a pipe-dream for a good many years.
The word pipe has been used as a synonym for opium smoking since the mid-19th century. From Robert Fortune’s 1847 Three Years’ Wanderings in the Northern Provinces of China:
These infatuated people may be seen...laughing and talking wildly under the effects of a first pipe.
(Source: Oxford English Dictionary, 3rd Edition)
Copyright 1997-2014, by David Wilton