When did the words 麻醉 and 麻药 first appear?
I assume you're looking for how Chinese translated the technical terms, which according to the OED were invented by Oliver Wendell Holmes in 1846.  

Chinese has early claims for anesthetic compounds a couple of thousand years before this, going back to the hoary Hua Tuo.  Wikipedia's article on the history of general anesthesia has a few things about him. There is more in the article on the Japanese doctor Hanaoka Seishū, reputedly the first person to perform an operation using general anesthesia. 

Both of these articles represent Wikipedia at its least reliable (look at the references), and in any case are not about the medical practices which Holmes christened in the 19th century.

As the comment from 倪阔乐 above mentions, the word ma-yao appears in Shui-hu-chuan (late 16th cent.) as a name for a general type of drug that is probably something like knock-out drops. 

Shui-hu-chuan calls the ma-yao in question 蒙汗藥 meng-han-yao, a drug which also appears in plays from the Yuan dynasty (13th cent). People who get dosed with 蒙汗藥 usually wind up as steamed meat buns in shops run by people you would not like to meet in a dark alley. Despite the claims of various dictionaries, I would not call this an anesthetic.

I would say that this is a difficult question, not an easy one. You will have to hunt around in early accounts for yourself, and this could be tough. The book Anesthesia: Essays on its history has a chapter by S. Yong called "History of Modern Anesthesia in China". Alas, it's only 3 pages long.  Clearly there's a lot to be done.