At the beginning, coffee was connected to Islamic mysticism. In the second half of the 15th century Yemenis Sufis started drinking coffee to help them stay awake and reach ecstasy in their nightly devotions. The Yemenis had been importing the beans from Ethiopia (where the coffee plant grew naturally), but they soon began to cultivate them in their own land. From Yemen the beverage spread along the Red Sea to Hedjaz and Egypt, and from there to the Ottoman Empire: by the early 16th century its consumption had massively widened beyond the circles of Sufis. A new institution, the coffeehouse, appeared. From Mecca to Cairo and from Istanbul to Algiers coffeehouses multiplied and attracted more and more clients. This is when social and legal issues arose.
A good account of these issues can be found in a French book (based on Arabic sources) from 1699: De l’origine et du progrez du café by Antoine Galland. Coffee-drinking was forbidden for the first time in Mecca in 1511; the ban was soon lifted, but was imposed again in 1524 and 1542. In Cairo, in 1534, a mob of religious fanatics attacked the coffeehouses, molested owners and patrons, and systematically broke coffee-related utensils into pieces. In Istanbul, in the course of the 16th and 17th centuries, the government repeatedly attempted to prohibit coffee and coffeehouses. Penalties were sometimes extremely severe: in 1656 in particular, under the Grand Vizier Köprülü, offenders who were caught drinking the black potion were sewn into a bag and thrown into the sea.
Underlining these on-and-off prohibitions, there was in the Muslim world a legal, medical and religious controversy around coffee that lasted almost two centuries. The beverage itself was held responsible of many sins: to be unhealthy, to inebriate (coffee was accused to be a kind of wine) and to transgress Islamic law. Other sins, no less serious, were ascribed to coffeehouses. These often were indeed places were clients indulged in activities (such as gaming, dancing, prostitution or drugs taking) condemned by religious or moral standards. Coffeehouses were also regularly blamed for distracting men from their work, family and religious duties. Last but not least, these establishments constituted just about the only public space were people could talk about politics, and therefore governments suspected them to be hotbeds of subversion. This political consideration was probably the main reason behind the prohibition imposed by Köprülü in 1656, at a time when the Venetians, after having defeated the Ottoman fleet, were directly threatening Istanbul.
Ten years earlier, Venice had been the first European city (apart from those in the Ottoman Empire) to have a coffeehouse. From then on, coffee consumption in Europe followed an exponential path. In Protestant countries the beverage did not raise any major legal issue. On the contrary, it seems that part of the Catholic clergy was opposed to it, on the ground of its Islamic origin and popularity. According to a tradition, perhaps apocryphal, the pope Clement VIII (the same who sent Giordano Bruno to the stake) had been pressured to ban coffee; loving it himself he decided instead to baptize the dark beverage, ending in such a way any further religious dispute.
Paradoxically it was in its birthplace, Ethiopia, that coffee found the strongest and most enduring opposition. Around the 17th century the local Church decided to prohibit it considering it to be an Islamic drink (tobacco and khat were forbidden for the same reason). Only in the last decades of the 19th century was the prohibition progressively softened and Ethiopian Christians finally allowed to consume coffee.