The history of coffee dates back to ancient Ethiopia, where the plant species Coffea originated. One of the legends about the discovery of coffee is that of Kaldi, a goatherd who was puzzled by the strange antics of his flock. About 850 CE, Kaldi supposedly sampled the berries of the evergreen bush on which the goats were feeding and, on experiencing a sense of exhilaration, proclaimed his discovery. At some point, perhaps as late as the 15th century, coffee plants were taken across the Red Sea to southern Arabia (Yemen) and placed under cultivation. Tradition holds that Sufi monks were among the first to brew coffee as a beverage and used the stimulation to pray through the night. Whatever the actual origin of coffee, its stimulating effect undoubtedly made it popular in Arabia. Ironically, though some Islamic authorities pronounced the drink intoxicating and therefore prohibited by the Quran, many Muslims were attracted to the beverage as a substitute for alcohol, also prohibited by the Quran. Despite the threat of severe penalties, coffee drinking spread rapidly among Arabs and their neighbors and even gave rise to a new social and cultural entity, the coffeehouse. Called qahveh khanehs, coffeehouses appeared in Mecca in the 15th century and in Constantinople (now Istanbul) in the 16th. They became popular meeting places where men of learning often gathered to converse, play chess or backgammon-type games, sing and dance, listen to music, discuss politics and news of the day, and smoke and drink. They became known as “schools of wisdom” because of the clientele they attracted, and though political and religious leaders feared the free and frank discourse common in such establishments, their frequent bans on coffeehouses were impossible to maintain.
I hope this information helps. Let me know if you have any other questions.