The first-principles calculations are carried out to investigate the influence of the presence of divalent ions, Mg2+ and Sr2+, on the elastic properties of hydroxyapatite. The calculated elastic moduli for pure hydroxyapatite are in good agreement with the experimental values. After examination of the geometrical structures of hydroxyapatite doped with the divalent ions, the elastic properties of the models are investigated.