The field theoretic renormalization group and operator product expansion are applied to the Kazantsev--Kraichnan kinematic model for the magnetohydrodynamic turbulence. The anomalous scaling emerges as a consequence of the existence of certain composite fields ("operators") with negative dimensions. The anomalous exponents for the correlation functions of arbitrary order are calculated in the two-loop approximation (second order of the renormalization-group expansion), including the anisotropic sectors. The anomalous scaling and the hierarchy of anisotropic contributions become stronger due to those second-order contributions.