Here is where it comes from:
"Nearly all the great discoveries of men in the last half century have, in one way or another, either directly or indirectly, contributed to prove Joseph Smith to be a Prophet.
"As far back as 1837, I know that he said the moon was inhabited by men and women the same as this earth, and that they lived to a greater age than we do – that they live generally to near the age of 1000 years.
"He described the men as averaging near six feet in height, and dressing quite uniformly in something near the Quaker style.
“In my Patriarchal blessing, given by the father of Joseph the Prophet, in Kirtland, 1837, I was told that I should preach the gospel before I was 21 years of age; that I should preach the gospel to the inhabitants upon the islands of the sea, and to the inhabitants of the moon, even the planet you can now behold with your eyes.”
(The Young Woman’s Journal, published by the Young Ladies’ Mutual Improvement Associations of Zion, 1892, vol. 3, pp. 263-64)
Dan Vogel is an independent historian (not affiliated with the LDS church and is pretty reliable.)
Author Dan Vogel notes the following:
“The statement in Abraham 3:5 that the moon is greater than the earth would hardly make sense if the moon were a desolate globe. Of course the pronouncements of Oliver Cowdery and Hyrum Smith that every star and planet was inhabited implied an inhabited moon. Like their contemporaries, Mormons were fascinated with possible inhabitants on the planet closest to earth. Encouraged by the recent spectroscopic discoveries which indicated that the moon had an atmosphere, Oliver B. Huntington related in 1892 an occasion on which Joseph Smith was purported to have expressed his belief that “the moon was inhabited by men and women the same as this earth.” According to Huntington, Smith described the moon’s inhabitants, saying that “they lived to a greater age than we do—that they live generally to near the age of 1000 years,” that the men averaged “near six feet in height, and dres[sed] quite uniformly in something near the Quaker style… The literature of the day also described supernatural ways of going to the moon and other planets. Later in the nineteenth century, when science began replacing supposition regarding an inhabited moon, Mormons refused to give up their belief, which they believed was rooted in revelation. An article entitled “Are the Worlds Inhabited?” appeared in the Latter-day Saints’ Millennial Star in 1882 to defend the Mormon position against the advances made by science: “To the question, is the moon inhabited? astronomers have returned a definite negative answer. It has been claimed that the moon is a dead world, without atmosphere, without vegetation, without moisture, and consequently without inhabitants.… On this subject the Latter-day Saints have the advantage of a little definite information.… ‘That by him and through him and of him the worlds are and were created, and the inhabitants thereof are begotten sons and daughters unto God [LDS D&C 76:24; RLDS D&C 76:3h].’… The worlds are inhabited—millions of them. They form the abode of the offspring of Deity. Birthplaces, probation planets; prison houses; spirit spheres; paradises; gehennas; homes for the resurrected; glorified suns for perfected and celestialized intelligences; all moving in their respective orbits, governed by fixed laws adapted to their condition and that of their inhabitants.” First-generation Mormons resisted any changes in their cosmological concepts. To them these were not just ideas or theories; they explained reality as they knew it.
Dan Vogel. The Word of God, p. 209-210
mrm.org/moon-men