17–7 PH stainless steel is a highly versatile material with a multitude of applications in a diverse range of fields, including aerospace, chemistry and petrochemistry, and medicine. The material’s exceptional mechanical properties and corrosion resistance render it the optimal selection for numerous components and instruments. Nevertheless, the surface properties of 17–7 PH stainless steel are inadequate for applications requiring high hardness and wear resistance in certain extreme environments. Due to its excellent mechanical properties and corrosion resistance, it can be utilized in the manufacturing of pharmaceutical equipment components. However, certain specialized environments still require surface nitriding treatment. Considering the complex heat treatment process required for this material, this paper reports a detailed study of the surface performance changes of 17–7 PH steel before and after ion nitriding following aging heat treatment. The study employs rolled 17–7 PH stainless steel as the subject material. The impact of heat treatment on plasma nitriding of stainless steel is investigated by comparing and analyzing the influence of martensite content and dislocation density within the martensite of the material prior to and following heat treatment on the hardness, thickness, and corrosion resistance of the nitrided layer on the surface of the steel after nitriding. The results demonstrate that 17–7 PH stainless steel, which does not undergo heat treatment, exhibits a high internal dislocation density, a high nitriding efficiency, and consequently, a high surface hardness. Following the application of a heat treatment, there is an increase in the martensite content of 17–7 PH stainless steel, a decrease in the dislocation content, and an increase in the matrix hardness.