The idea that Joseph taught the moon is inhabited comes from the writing of Oliver B. Huntington in 1881 (his journal) and in 1892 (the Young Woman's Journal). Huntington claimed that Joseph Smith's father had given him a patriarchal blessing in 1837 which promised that he would preach the gospel to the moon inhabitants.
Close examination reveals that Huntington was only ten years old when he was given this blessing and that his recollections were made over fifty years later. Also, it turns out that the blessing was given by his own father, not Joseph Smith's father.
According to a copy of the blessing in the Church archives (Blessing Book, vol.9, pp.294-95), it was only one of many given the same day at the same meeting, and none were recorded in detail at the time. Orson Pratt took sketchy notes as the blessings were given, then filled in details later by consulting those who were there. An examination of the blessing shows that the recorded blessing was much more vague than Huntington remembered.
It also appears that Huntington may have picked up on a rumor that Joseph Smith had given a description of the inhabitants of the moon. This description, which Huntington recorded in his journal, is the original source of the anti-Mormon claim that Joseph described the moon inhabitants. Because his journal is also cited in a Young Woman's publication of the Church, it supposedly gives more credibility to the critics. The statement, which appeared in a two-page article by Oliver B. Huntington entitled "The Inhabitants of the Moon" in the Young Woman's Journal, is as follows:
As far back as 1837, I know that he [Joseph SmithJ said the moon was inhabited by men and women the same as this earth, and that they lived to a greater age than we d~that they live generally to near the age of a 1,000 years.From what is quoted here, the most we can conclude is that 0. B. Huntington was familiar with rumors of statements that were attributed to Joseph Smith. However, there is nothing in the writings of Joseph Smith or those who recorded his words prior to his death that even hints of any these views about inhabitants on the moon. This earliest recollection was recorded in 1881, 37 years after the prophet's death.He described the men as averaging nearly six feet in height, and dressing quite uniformly in something near the Quaker style (Young Woman's Journal, Vol.3, p.263).
Even if it turned out that the prophet held these views, nowhere does scripture suggest that a prophet is not allowed to speculate about things that haven't been revealed. Many people during the Nineteenth Century, both the learned and not-so-learned, were speculating on this subject. Joseph Smith's personal opinions and what he taught as revealed doctrine, however, are two entirely different things. The idea that he taught it as a revealed doctrine is based upon Oliver B. Huntington's fifty-year-old, correct or incorrect memory of his blessing, and a rumor that was current in 1881.
Another aspect of the matter needs to be considered. At the present time, man has no scientific or revealed knowledge of whether or not there are inhabitants on the earth's moon. The fact that a handful of astronauts didn't see any inhabitants in the tiny area they viewed when they landed on the moon decades ago certainly gives no definitive information, any more than visitors to earth who might land in barren Death Valley would have any idea of the billions of inhabitants elsewhere.
John the Revelator "saw an angel standing in the sun" (Rev. 19:17). Perhaps we have much to learn about inhabitants of other heavenly spheres.
For further information see Van Hale, "How Could a Prophet Believe in Moonmen?" Mormon Miscellaneous Response Series #4.
Another article on Joseph Smith and moonmen..