Mars gets its red color because the planet’s soil is rich in iron oxide. Where did all this iron come from? Scientists have two theories.
One idea is that early Mars was covered with water, which could have worn away ancient rocks rich with water. This iron could have been transported across the planet through rain, and then, when the waters went away, the iron remained.
Another idea is that iron comes from meteorites. You just have to look at the surface of Mars and see the numerous craters to know that the planet has been pounded by space rocks for billions of years. some of these would have been mostly iron in composition. These would have scattered iron around the planet as they crashed into the surface and exploded in the atmosphere.
Determining the exact color of Mars is actually pretty difficult. This is because spacecraft and rovers capture false color images of Mars, which are then color-corrected on computer back on Earth. Different scientists have mixed the colors differently to produce different ideas of what Mars might look like. In fact, the earliest images released by the Viking Lander were colored with blue skies, instead of the more familiar red we know today.
NASA’s Mars Exploration rovers are equipped with a special color calibration targets which engineers know the true colors for. They can then take images with these in view, and then color correct the images on computer. If the colors on the rover are correct, then the scientists assume the rest of the colors in the image are correct too.
Here’s a comprehensive article from Universe Today about how scientists go about determining true color on another planet, or in deep space. It’s a fascinating process.