The quinine was added to the drink as a prophylactic against malaria, since it was originally intended for consumption in tropical areas of India and Africa where that disease is endemic.
Tonic water is often used as a mixer for alcoholic spirits, especially gin (the mixture commonly known as a gin and tonic).