Medication refers to prescription drugs recommended and authorized by a physician, typically after an examination of the patient.
Since time immemorial mankind has noticed that certain herbs, extracts and other natural substances have positive effects on certain maladies. With the advent of modern science, these have been better identified and tested, and many of the active chemicals involved have been synthesized. A great example of this is aspirin (salicylic acid), which was isolated from the source for which it is named, the willow tree (Salix spp.), and then synthesized in the lab.
There have been many steps along the way which have revolutionized medicine, like the discovery that certain fungi have an antibiotic effect, killing harmful bacteria. The first identified member of this mow large family of drugs was penicillin.
In the last few decades there have been tremendous advances in the invention and manufacture of wholly synthetic substances designed for specific pharmacological effects. Two well known groups of these are the synthetic painkillers and anti-depression drugs (SSRIs). As the details and mechanisms of various ailments become better known, drugs that are more and more specific (having less side effects) can be engineered.