Studies on the effect of changing the stiffness coefficient along the length of the pipeline on its resonant vibration mode are considered in the paper. A computational model of transverse vibrations of the pipeline located in soil with different properties is created. Theoretical and computational studies to solve the problems of stability of underground pipelines located in the soils with different properties under seismic effects are carried out. It is revealed that the vibratory process of the pipeline can be realized at frequencies close to resonance. The results of the study are presented as curves of distribution of displacements of pipeline sections along the length at dimensionless frequencies. When the pipeline vibrates with a frequency close to the resonant frequency, the displacements of pipeline sections can take very large values. It is shown that at frequencies close to resonance, the values of moments can be large in the pipeline sections, which are the reasons for the loss of pipeline stability.