Ooh, pick me!
Okay, I don’t know of a definitive answer, though I’m leaning towards “probably okay,” but I can definitely complicate this scenario!
1. Background:
Jewish burials demand that when a person is buried, they be buried in the ground in a plain wooden casket, so that they can “return to the earth” as quickly as possible. We’re pretty extra about the caskets. Wooden dowels used in place of screws so that there’s no metals, biodegradable materials only, etc. Also, in my experience, we’re not very squeamish about the caskets. I built a casket at age 13 at a synagogue event. (On second thought, that may not actually be considered normal.)
2. The question:
The relevant question, then, is whether the burial facilities on the moon count as “the ground.” I’m thinking about the creation story: Adam is created from ״עפר מן האדמה״, afar min ha-adama, or “dust from the ground.” (Bereishit/Genesis 2:7). Rashi comments on the seeming repetition of using both afar and adama: the double language is because Adam was created out of earth from all of the world, so that in every place that a person would die, in that place they could be buried.
So what does Rashi mean when he talks about the whole world?
Rashi uses the very vague term “from the four winds,” or “four directions.” (For the verse with Rashi in both Hebrew and English, see here). It is thus useful to look at the broader context of what is categorized as “the earth” vs. “the heavens.”
Generally, when the Torah or halacha wants to talk about something applicable to the whole world, they use the phrase “on the earth.” Similarly, a distinction is drawn between the “earth” and the “heavens” - the Torah is not in the heavens, for example, or see the verse in Psalms: the heavens are heavens for Hashem, and the earth was given to the children of man. There is a split between those who define the earth as literally the Earth and the heavens as anything, say, outside the atmosphere, and those who define the heavens as something spiritual, beyond our reach. In the second category, you can find older commentators such as the Ramban (Nahmanides), who defines “heavens” as the category of things that have no physical bodies, along with more modern rabbis who lived to see space travel and greater understanding of space generally. The first category contains more literalist interpretations of the world.
As far as I can tell, the definition of “the heavens” as something spiritual, leaving “reachable space” under the category of “earth,” is the better-supported one. After all, if the Torah is not in the heavens, but we are… does that mean we don’t have to keep halacha? What about the fact that in Devarim (Deutoronomy) there is a commandment to keep the Torah all the days you are alive on earth?* In addition, more and broader-accepted rabbis are behind the second category.
3. TL; DR - Conclusion:
As a result, it makes sense to conclude that Rashi’s “all four directions” could plausibly include “every physical celestial body,” making it permissible to bury Jews on the moon: it will count as “returning to the earth,” which, as mentioned above, is what Jewish burial is trying to achieve.
4. Footnotes and sources:
Footnote: if you have to live on a colony, I would imagine that rabbis would be pretty lenient in deciding whether you could have a proper burial there. After all, better an approved, if by small margins, Jewish burial than someone remaining unburied.
Second footnote: You would probably want a system that allows for decomposition of the body, since that’s part of “returning to the earth.” I don’t know how that would work on the moon.
Asterisk: There is actually an opinion that halacha doesn’t apply in space for these reasons, but it is pretty broadly rejected and viewed as radical. See here for some more details.
Some sources and relevant links: Is there a legal minimum on the amount of soil needed to make a grave, Can a Jew who dies on Mars be buried there (too literalist in my opinion, but presents one argument), What defines the earth from a halachic standpoint, and Does the Torah prohibit leaving Earth, all from Mi Yodeya. Also For it is not in Heaven…or is it?: On the Halakhot and Hashkafot of Space Travel, and this site about Halacha and space [responsa are in Hebrew, message me for translations]. Additional source: my grandfather.