There wouldn't be enough oxygen for any bacteria to decompose the body, right? Not to mention, the radiation of space might kill off most organisms on it. So would it decompose, given millions of years?
2$\begingroup$ You should read "The Gentle Giants of Ganymede." The beginning starts with present-day astronauts discovering a (something like) 100,000 year old human skeleton on the moon. Sorry...not an answer, but your question so much reminded me of that novel. $\endgroup$– BillDOeOct 8, 2015 at 5:50
$\begingroup$ On Space Exploration, see space.stackexchange.com/questions/5666/… and space.stackexchange.com/questions/308/… $\endgroup$– HDE 226868 ♦Oct 8, 2015 at 14:58
Space, as Randall notes, is really dry. Mars, (recent discoveries notwithstanding) is not much moister.
In these conditions, bodies mummify.
The microbes that live in you, wouldn't survive the freezing, dessication and radiation. There is no real upper limit on how long a mummified body could exist in space. There would be nothing to cause the body to change, and so it would remain. There would be a slow breaking down of surface proteins, due to UV light, and eventually micrometeorites would erode the body, but these processes would take many millions of years.
Mars is hot enough to keep a body unfrozen oxygen and moisture also speed up the decaying process. A dry environment and constant heat like a desert would mummify a person like beef jerky.If the moon is always under freezing and no air the body would be freeze dried and look like a wax version of themselves forever.
1$\begingroup$ Did you get Mars and the Moon mixed up in your writing? The Moon gets hot when it faces the sun. Mars can rise above freezing, but only during the day and around the equator. $\endgroup$– userLTKOct 8, 2015 at 18:50
$\begingroup$ Temperature conditions are Mars are actually a very interesting topic, due to the wisp-like atmosphere, temperatures near the equator can vary greatly. Not to mention the low pressure, which would boil any water away. $\endgroup$ Aug 10, 2016 at 14:23