The prohibition against coffee is contained in one of Mormonism’s scriptures, section 89 of Doctrine and Covenants (D&C). This section is called the Word of Wisdom. Among other instructions, it prohibits the use of alcohol, tobacco and hot drinks. Subsequently LDS prophets said that hot drinks referred to coffee and tea.
Keeping the Word of Wisdom is extremely important to active Mormons. Breaking it is considered a major sin in Mormonism. So much so, that failing to keep it disqualifies a Mormon from being able to enter the temple.