Simple answer, gravity!
There are advantages to building and living in colonies on the moon and Mars. There is a great deal of space available and much resources. One can readily scout for water or other essentials in a simple "stroll" out the front door. All the materials needed to build the colony and expand it are at hand and can be harvested without the need for distant transportation ... much like here on Earth.
The gravity on mars is only 38% that of Earths and the moon is only 16%. This is great, we will be able to leap tall building in a single bound! Heavy tasks will be lightened. Our physiology will weaken. The micro gravity environments of Mir and ISS and the likes have taught us that the human body changes due to its environment. Our hearts shrink, our bone density declines our muscles atrophy. These effects are reversible in the short term but we do not know if they would after extended exposure to low G's.
This is only part of the problem. What about our offspring and the generations to follow? Would we be be Devolving? Our offspring would be very weak and quite likely would not be able to survive if they were to return to Earth. It would be the initial trauma of a 100kg man suddenly weighing 300kgs (600kgs if a lunar offspring). His vascular system would not have sufficient blood to compensate for the rush of blood to his legs and feet. His heart would likely not be strong enough to continue to circulate his blood adequately.
One reason often given to justify a lunar or Mars colony is to protect the human species from catastrophic demise. But the Earth is far better equipped to protect us than either the moon or Mars. We have a significant atmosphere and a magnetic shield both are absent on the moon and Mars. Our magnetosphere provides a great first defense against cosmic radiation and our atmosphere is able to break apart asteroids that threaten our survival .. to some extent. A small asteroid of a couple of meters diameter would likely do little if any damage here on Earth but the same asteroid could compromise the artificial atmosphere integrity of a colony on the moon or Mars. Even if such colonies were buried under significant regolith, it would still be vulnerable to relatively small impacts.
Orbital habitats can produce artificial gravity providing an environment virtually identical to Earth. These habitats are somewhat mobile and can be moved slightly to avoid asteroid collisions. They provide the "best" platform for space exploration as there is very little delta V required to launch from an orbital platform/habitat compared to Earth, Mars and the moon. An orbital habitat can be anywhere, there is no need to wait 4 years for it to be "close" to Earth to supply it or send someone home. The can also provide the best opportunities for scientific study in that any gravity from micro (virtually zero) to far greater than Earth can be generated on a single facility ... this cannot be done on Earth, Mars or Moon.
Our technological understanding is sufficient for us to build these orbital habitats. Only governments and bureaucracy prevent their existence. Many would argue that the cost is prohibitive but our project and its fundamental strategy shows that cost is insignificant if one build a "large" habitat. For example: if it costs $1billion to put an asteroid mining and metal smelting operation in space, then a space habitat built to house 100 people would cost each person $10million. But that same mine could build a habitat for 100,000 people at no extra cost .. just time thus the cost is just $10,000 per person.
One more thing, orbital habitats that are designed and built right could become colonial ships sent out of our solar system to reach new stars with Earth like planets. It would be impossible (realistically) to send Mars out of our solar system.