Magnesium and its alloys are excellent implant material candidates with their biodegradable structure and mechanical properties close to human bone. In order to provide the desired strength in implant applications, the corrosion resistance of the materials is expected to be high. In this study, to improve the corrosion resistance of AZ31 and AZ91 magnesium alloys, an electrostatic hydroxyapatite coating process was applied, and optimum conditions were determined. The samples were structurally characterized by scanning electron microscopy/energy dispersive X-ray spectroscopy and stereo microscopy methods, and their corrosion behavior was determined by the weight loss method. As a result of the coating, the corrosion resistance of the samples increased up to 250 %.