Friction stir processing (FSP) and subsequent aging heat treatment were used to modify the microstructure of AZ80 magnesium alloy. The influence of FSP and aging heat treatment on the corrosion behavior was systematically studied by using potentiodynamic polarization, immersion, and slow strain rate tensile tests. The results revealed that FSP led to grain refinement, rapid dissolution of β‐phase, and the deflection of c‐axis from transverse direction (TD) and processing direction (PD) by approximately 55° and 25°, respectively, improving the static corrosion and stress corrosion cracking (SCC) resistance. The aging heat treatment rendered a little influence on the grain size and slightly affected the grain orientation. The content of β‐phase in FSP‐5 and FSP‐24 samples was 8.1 and 21.8 wt.%, respectively. Static corrosion and SCC resistance of FSP‐5 and FSP‐24 samples were lower than those of the FSP samples. Compared with FSP‐5 sample, the amount of β‐phase and the proportion of Al2O3 increased in FSP‐24 sample, leading to enhanced static corrosion and SCC resistance. SCC behavior was controlled by anodic dissolution, whereas the presence of hydrogen accelerated the SCC.