Abstract We report on density functional quantum mechanical calculations of hydroxyapatite. The central focus is dedicated to the local arrangement of hydroxide ions in proximity of defects originating from substituting OH− by F− or O2− ions. At ambient conditions the preferred structure of bulk hydroxyapatite exhibits an ordering of OH− ions oriented in rows along the [001] direction. From zero Kelvin geometry optimizations the orientation inversion of a hydroxide ion was found to be disfavored by 0.165 eV. This picture changes dramatically when replacing one of the OH− ions by a fluoride ion. The preferred hydroxide ion arrangement next to the F− defect was identified as an OH−··F−··HO− constellation, which implies the orientation inversion of one of the neighboring hydroxide ions. An analogous phenomenon was observed for O2− defects.