Heroin is a semi-synthetic opioid synthesized from morphine, a derivative of the opium poppy. It is the 3,6-diaceytl ester of morphine. Heroin does have analgesic properties and actually has the same addictive potential as morphine. In 1914, a law was passed which allowed heroin to be prescribed and used for medical purposes. But then heroin was banned from the united states in 1924.
This article does make mention of the use of heroin in cases of terminal illness. You can possess heroin in the United States only if you have a DEA license.
Very interesting :)