Snake oil originated in China where it was used as a remedy for inflammation and pain.  Snake oil is still used as a pain reliever in China. 

Purported to reverse aging and grow hair, snake oil also played a role in ancient Egyptian medical practice, where it was mixed with fat extracted from lions, hippos and other indigenous species.  

First used by Chinese laborers in the 19th Century,  snake oil became a generic name for many compounds marketed as cure-alls whose ingredients were usually secret, unidentified, or intentionally mislabeled.  Though mostly inert or ineffective, due to the placebo effect and liberal quantities of alcohol or sometimes cocaine, the concoction might provide temporary relief for whatever the user wished to alleviate.

Since there was no federal regulation in the United States to ensure safety and efficacy of drugs until the 1906 Food and Drugs Act, snake oil eventually became the synonymous with fake medicine.  

The snake oil peddler became a common fixture of the 19th Century migration westward.  Usually, a traveling "medicine man" with dubious credentials, could be found selling lotions and potions (such as snake oil) with a great deal of marketing hoopla.  His show would often supported by psuedo-scientific evidence, typically unsubstantiated.  Often, an accomplice in the crowd, i.e. a shill, would loudly "attest" the miraculous abilities of the product in an effort to provoke buying enthusiasm. The "doctor" would prudently leave town before his customers realized that they had been cheated. This practice is also called "grifting" and its practitioners are called grifters.   

The practice of selling dubious remedies for real (or imagined) ailments still occurs today, albeit with some updated marketing techniques. Claims of cures for chronic diseases (for example, weight loss, hair loss, etc., for which there are presently only palliative treatments available from scientifically-validated medicine are especially common.  The term snake oil peddling is still used as a derogatory term to describe such practices.