Strictly speaking, both morphine and heroin are derived from opium, a naturally occurring substance in the opium poppy, (but I accept that more post was misleading)
The use of both is entirely legal, provided it is obtained on prescription and used under medical supervision.