Prior to the discovery of Sildenafil (the active ingredient of Viagra and it’s competitors), was there any type of substance known to have been used for erectile enhancement? If so, what, when and by whom?
You don't specify where, so here's in Netherland Indies, now Indonesia. The region is never in shortage of virility-enhancing medicines, owing fairly from Chinese medicinal influence and the long-standing tonic tradition in Java, commonly known as jamu. Not all jamu were consumed as potency-enhancing drugs for sex; only a specific concoction called as jamu kuat (power jamu) were. The ingredients, both for jamu and its Chinese medicine variants, were based on knowledge of local plants.
"Book of Secrets on the Relationship between Women and Men" provide this recipe for readers to make their own love potion (quoted from Hoogervorst, 2016).
Recipe for increasing your sex drive (nafsoe birahi). For men or women who lack the energy and lust to make love (bertjintahan), there are various recipes, among which: pills to get the sex drive going; Ginger – 5 gram. Musk – 10 gram. Cloves – 10 gram. Saffron – 20 gram. Ambergris – 20 gram. Mastic in tears (matiek [sic!] in tranen) – 30 gram. Grind everything into a fine powder; mix it thoroughly with 1 kilo of white sugar, and finally shape it like a cake (koewee); then roll it into pills of 15 gram each. Take 8 – 10 – 12 – 15 or more pills per day.
It is important to note that the development of medicine does not take linear steps in history. The introduction of Western "modern" medicine in Indonesia does not replace jamu. Jamu is still consumed today.
In fact, jamu has become more associated with sex as Western medicine took over demands for illness medication. Jamu is recognized by the National Agency of Drug and Food Control as "traditional medicine" (it's a field of STS that I can't elaborate further as it's not my expertise). In supermarket isle, jamu and condoms are grouped next to each other, pointing to jamu's association with sex. Many rely more on jamu due to the perception that pills such as viagra have more side effects, as it is believed to be more "artificial" and chemically altered (Krier, 2000).
Sorry for the dry writing; it's a bit late here.
Sources
Hoogervorst, Tom. "Manliness in Sino-Malay publications in the Netherlands Indies." Southeast Asia Research 24(2):283-307.
Krier, Sarah. 2000. "Our Roots, Our Strength: Jamu Industry, Women's Health, and Islam in Contemporary Indonesia." Dissertation, University of Pittsburgh.