The origins of sake are unclear; however, the earliest written reference to use of alcohol in Japan is recorded in the Book of Wei, of the records of three kingdoms. This 3rd century Chinese text speaks of the Japanese drinking and dancing. Sake is also mentioned several times in the Kojiki, Japan's first written history, compiled in 712.

People used sake for spiritual functions because people who drink it get a fever and what they believed to be a "spiritual high".

During the Meiji restoration, laws were written that allowed anybody with the money and know-how to construct and operate their own sake breweries. Around 30,000 breweries sprang up around the country within a year. However, as the years went by, the government levied more and more taxes on the sake industry and slowly the number of breweries dwindled to 8,000.
Most of the breweries that grew and survived this period were set up by wealthy landowners. Landowners who grew rice crops would have rice left over at the end of the season and, rather than letting these leftovers go to waste, would ship it to their breweries.
During the 20th century, sake-brewing technology grew by leaps and bounds. The government opened the sake-brewing research institute in 1904.
Yeast strains specifically selected for their brewing properties were isolated and enamel-coated steel tanks arrived. The government started hailing the use of enamel tanks as easy to clean, lasting forever, and being devoid of bacterial problems. (The government considered wooden barrels to be unhygienic because of the potential bacteria living in the wood.) Although these things are true, the government also wanted more tax money from breweries, as using wooden barrels means that a significant amount of sake is lost to evaporation (somewhere around 3%), which could have otherwise been taxed. This was the end of the wooden-barrel age of sake and the use of wooden barrels in brewing was completely eliminated.
When World War II brought rice shortages, the sake-brewing industry was dealt a hefty blow as the government clamped down on the use of rice for brewing.
After the war, breweries slowly began to recover, and the quality of sake gradually went up. However, new players on the scene—beer, wine, and spirits—became very popular in Japan, and in the 1960s beer consumption surpassed sake for the first time.
Sake consumption continued to go down while, in contrast, the quality of sake steadily improved.
Today, sake has become a world beverage with a few breweries springing up in China, Southeast Asia, South America, North America, and Australia. More breweries are also turning to older methods of production.