You seem to be confusing the words "Schmerzmittel" (analgesic, pain killer) and "Betäubungsmittel" (narcotic). Those two classes of substances are not the same.
Interestingly, in both cases the semantic shift seems to have been caused by the enactment of laws to control drugs. The legal term these days is probably "controlled substance" in English, but "narcotic" now definitely refers to many drugs that are not medically narcotic.