Mushrooms with psychedelic properties have been used since prehistoric times for a variety of reasons, including ritualistic, medicinal, problem-solving, and recreational uses. 
Scientists haven't been able to pinpoint where these mushrooms fit in the fungal family tree, but emerging research is helping them understand the evolutionary development of "magic" mushrooms.
Our modern world first discovered hallucinogenic mushrooms in the 19th century, which led to research into their taxonomy, biochemistry, and historical usage. There hasn't been much research on how these mushrooms evolved until now.
Gastón Guzmán, the world authority on the genus Psilocybe (the group of small mushrooms that possess hallucinogenic properties), began studying its taxonomy in the 1950s. Researchers from the University of Guadalajara and the University of Tennessee are collaborating with Guzmán to put together a hypothesis for how these mushrooms evolved.
The researchers used new molecular and computational techniques to produce a multi-gene evaluation of these mushrooms. This is the first step in being able to accurately classify and name them.
Earlier work found that the species of Psilocybe did not descend from a common ancestor. Scientists then separated the hallucinogenic species from the non-hallucinogenic relatives in their classification. The latest findings place the two groups into different families: the Psilocybe (family Hymenogastraceae) and the Deconica (family Strophariaceae s.str), which share a number of strong infrageneric connections.
Mushrooms most likely evolved independently rather than having a common ancestor. It is possible that they experienced evolutionary losses due to ecological reasons. The species of Psilocybe are united because they share the psychedelic compound psilocybin and other secondary metabolites.
The research paper, titled "Phylogenetic inference and trait evolution of the psychedelic mushroom genus Psilocybe suns alto (Agaricales)," was published in the journal Botany.

Image by ReflexPics, courtesy of Creative Commons licensing.