Taking seamless steel pipes with different pore content as the research object, an ultrasonic testing platform is built to collect ultrasonic signals of samples with different pores, and the fundamental frequency amplitude and second harmonic amplitude are obtained by Fourier transform to calculate the relative second-order nonlinear coefficients. We use a metallurgical microscope to take pictures of the micro structure of the sample, and use image processing methods to calculate the pore content and establish the relationship between the porosity of the seamless steel pipe and the relative second-order nonlinear coefficient. The results show that the relative second-order nonlinear coefficient gradually increases with the increase of the porosity of the seamless steel pipe. Therefore, the porosity of the seamless steel pipe can be characterized by the relative second-order nonlinear coefficient, and then the pore content of the seamless steel pipe can be evaluated.