Abstract Background The transition from land to sea by the ancestor of cetaceans approximately 50 million years ago was an incredible evolutionary event that led to a series of morphological, physiological, and behavioral adaptations. During this transition, bone microstructure evolved from the typical terrestrial form to the specialized structure found in modern cetaceans. While the bone microstructure of mammals has been documented before, investigations of its genetic basis lag behind. The increasing number of cetaceans with whole-genome sequences available may shed light on the mechanism underlying bone microstructure evolution as a result of land to water transitions. Results Cetacean bone microstructure is consistent with their diverse ecological behaviors. Molecular evolution was assessed by correlating bone microstructure and gene substitution rates in terrestrial and aquatic species, and by detecting genes under positive selection along ancestral branches of cetaceans. We found that: 1) Genes involved in osteoclast function are under accelerated evolution in cetaceans, suggestive of important roles in bone remodeling during the adaptation to an aquatic environment; 2) Genes in the Wnt pathway critical for bone development and homeostasis show evidence of divergent evolution in cetaceans; 3) Several genes encoding bone collagens are under selective pressure in cetaceans. Conclusions Our results suggest that evolutionary pressures have shaped the bone microstructure of cetaceans, to facilitate life in diverse aquatic environments.