We use two-dimensional numerical simulations and eikonal approximation to study properties of magnetohydrodynamic (MHD) waves traveling below the solar surface through the magnetic structure of sunspots. We consider a series of magnetostatic models of sunspots of different magnetic field strengths, from 10 Mm below the photosphere to the low chromosphere. The purpose of these studies is to quantify the effect of the magnetic field on local helioseismology measurements by modeling waves excited by subphotospheric sources. Time-distance propagation diagrams and wave travel times are calculated for models of various field strengths and compared to the nonmagnetic case. The results clearly indicate that the observed time-distance helioseismology signals in sunspot regions correspond to fast MHD waves. The slow MHD waves form a distinctly different pattern in the time-distance diagram, which has not been detected in observations. The numerical results are in good agreement with the solution in the short-wavelength (eikonal) approximation, providing its validation. The frequency dependence of the travel times is in good qualitative agreement with observations.