Magnesium alloys, with suitable strength, human-like elastic modulus and density, have potential medical applications in the field of biodegradable implant materials. However, one of the most important barriers to clinical applications of magnesium alloys is the rapid corrosion of these alloys in human body fluids. Grain refinement is an effective way to increase the strength and ductility of magnesium alloys and may improve the corrosion resistance of them. Grain refinement due to the thermomechanical process is an effective way to increase the strength and ductility of magnesium alloys and may affect the corrosion resistance of magnesium alloys. Hence, in this study, the effect of thermomechanical process (including warm forging at 250 ° C and then annealing for 1 hour at 300 ° C) on the corrosion behaviour of AZ31 magnesium alloy after 1, 4 and 7 days of immersion in a simulated body fluid was investigated at 25 ° C. To investigate the microstructure of the samples, an optical and scanning electron microscopes were used. The electrochemical polarization and impedance tests were used to evaluate corrosion rate and corrosion resistance, respectively. The microstructure analysis of the samples showed that the thermomechanical process refined the grain and caused the twins to appear. In fact, the recrystallization resulting from the thermomechanical process caused the grain to refine, increasing the grain boundaries, and reducing the dislocations density, which, in turn, prevented corrosion. The results of impedance and polarization tests also showed that the corrosion resistance of AZ31 sample under thermomechanical operation increased after 7 days of immersion and decreased its corrosion rate.