In the classical world, Hector Berlioz (1803 – 1869) is the name most frequently mentioned when talking about musicians and drugs.
In his correspondence we find
I am getting up; it is six o'clock in the afternoon; I took some drops of laudanum yesterday, and was completely stupefied.
and also
I can only write a line. I took a dose of laudanum last night, and have not had time to go to sleep quietly.
He also wrote about using it for medical reasons at least once.
Berlioz composed a program symphony (Symphonie Fantastique: Épisode de la vie d'un Artiste ... en cinq parties) about a guy poisoning himself with opium, it's his most popular work. The music is meant to tell you the story of what the guy experienced, it's kind of a psychedelic expedition.
Of course, there probably were other musicians before him doing drugs.