By the 19th century, the vanilla plant had long been used as a flavor, but it was generally gathered wild. That's because it's devilishly hard to farm. As this fascinating piece by Dan Nosowitz in Atlas Obscura notes, vanilla plants have a very small window where pollination can occur, and no-one's quite certain how vanilla plants are pollinated in the wild. So farmers, historically, had little luck.
The person who finally cracked the mystery? A young slave on the French colony of Île de Bourbon (which is now called Réunion), in 1841. As Nosowitz writes:
In 1841, a 12-year-old enslaved boy named Edmond Albius discovered the solution to the problem that had vexed some of the brightest minds in Europe and its colonies. Albius was known to be awfully bright. The Frenchman who owned him, Ferreol Bellier-Beaumont, was a botanist who quickly realized that Albius had a gift for plants, so he became something of a botanical assistant. (Without his freedom, at that point.) Bellier-Beaumont was one of the many Europeans who had a vanilla vine on his property, a sort of unsolved botanical puzzle that he kept alive but fruitless.
A vanilla flower is hermaphroditic, so it has both male and female reproductive organs. Even better, it's fully capable of self-reproducing, and if those male and female organs touch, the flower will begin to form a fruit extremely quickly. But vanilla, for some unfathomable reason, has a thin membrane in between its reproductive organs, preventing that from happening. Albius figured out, thanks to some deft floral surgery, that if he pierced the side of the flower with a small, sharp piece of wood, he could manipulate that membrane out of the way and, using only his fingers, push the reproductive organs together. This is called, as Sarah Lohman writes in her book Eight Flavors, "the marriage," and it is one of the many sexual terms applied to the vanilla plant. (Even the word "vanilla" is derived from the Spanish for "sheath," the same root as "vagina.")
Albius did not receive any of the billions of dollars that his discovery made possible, and though freed in 1848 when slavery was outlawed on the island, his life was brutal and he died in poverty in 1880. By then, though, France had taken Albuis's method and begun to produce vanilla en masse in its tropical holdings.
Go read the whole piece — it's fascinating stuff, and yet another grim record of colonialism.
(That CC-2.0-licensed photo of vanilla being pollinated by hand is courtesy the Flickr stream of Brock)