An overwhelming number of bitters was created for medicinal purposes and now many of them are used as flavoring agents for other beverages (mostly cocktails and coffee).
These drinks were mostly created by monks or healers and only a few by professional chefs. Adding alcohol to herbs and roots began in the ancient world. The first historical evidence that informs about using juniper coins for manufacturing of medicinal elixirs, refers to the XII century. This was done by the Benedictine monks from Salerno monastery. In the Middle Ages people knew nothing about antibiotics, so doctors prescribed herbal tinctures for most diseases.
Monks and healers used grain, grape and fruit alcohols. The variety of components was huge: herbs, roots, berries, pine cones, nuts, etc. In most cases resipes of bitters were kept in a secret by monasteries or families.
Interesting, that people intuitively refused to consume food and bitter herbs, subconsciously believing them poisonous or unpalatable. Later, humanity found that they had useful properties and began to use bitter herbs and other components to make healing bitters.
Nowadays these ancient recipes are still used for preparing such popular bitters as Swedish Bitters, Angostura, Campari, etc.