Vanilla is the world's second-most costly spice, exceeded only by saffron. While we refer to vanilla seed pods as "beans," the plant is really an orchid, the only food-producing orchid in the world. You might also be surprised to learn that the plant is native to Mexico, and is thought to be pollinated by a specific Mexican bee in the wild, or maybe hummingbirds. Therefore, when Europeans colonized the Americas, they found it impossible to produce vanilla anywhere else.
Spain had a complete monopoly on vanilla at the time because nobody could figure out how to grow the damn thing outside of Mexico. It's not that people didn't try. There were attempts across Europe's tropical colonies in the early 1800s, and even in some greenhouses in the comparatively frigid cities of Western Europe. Those vines, propagated from clippings, often grew just fine, and sometimes even thrived and bloomed. But they hardly ever produced any fruit, which must have been extremely frustrating to the vanilla-hungry botanists of the 1800s.
So how did Madagascar become origin of most of our vanilla? 1. The breakthrough in hand pollination was made in French colonial Madagascar, by an enslaved 12-year-old who never received credit, 2. Thomas Jefferson's relationship with France, 3. The destruction of vanilla's natural environment in Mexico, 4. a marketing move by the French vanilla cartel, and 5. the criminally low cost of labor in Madagascar. Read the story of vanilla in Madagascar at Atlas Obscura.