"inspissated juice of the poppy plant," especially as used in medicine from 17c. for relief of pain and production of sleep, late 14c., from Latin opium, from Greek opion "poppy juice, poppy," diminutive of opos "vegetable juice, plant juice, fig curd," from PIE *sokwo- "juice, resin" (source also of Old Church Slavonic soki "juice," Lithuanian sakaī (plural) "resin").
Die Religion ist der Seufzer der bedrängten Kreatur, das Gemüth einer herzlosen Welt, wie sie der Geist geistloser Zustände ist. Sie ist das Opium des Volks. [Karl Marx, "Zur Kritik der Hegel'schen Rechts-Philosophie," in "Deutsch-Französische Jahrbücher," February, 1844]
The British Opium War against China lasted from 1839-42; the name is attested from 1841. Opium-eater, one who habitually uses opium in some form, is by 1821.