Animals were doing it long before humans even existed. Some birds will "bathe" in an ant nest because the formic acid excreted by the ants rids them of parasites. There's even a word for it - zoopharmacognosy.
Long before recorded history, people knew what plants were helpful to treat or cure various maladies. Who knows what possessed the first human to chew on willow bark to relieve pain or reduce a fever? The earliest documentation of it was 400 BCE by Hippocrates, but it was probably common knowledge for much longer than that. The Chinese have been using various herbs to treat disease for at least 3000 years.