rehab gives your body time to manufacture endorphins again, for body chemistry to get back to normal, and your body heal from the ravages of drugs. Also, it removes your dependance on the drug.
Btw, you get endorphins from pleasureable stuff, like food or sex. Its natural. Drugs flood your body...