A magnetohydrodynamic numerical model for the pellet ablation in the electrostatic approximation has been developed based on the method of front tracking. The main features of the model are the explicit tracking of interfaces that separate the solid pellet from the ablated gas, and the cold, dense, and weakly ionized ablation cloud from the highly conducting fusion plasma, a surface ablation model, a kinetic model for the electron heat flux, and an equation of state accounting for atomic processes in the ablation cloud. The model has been validated through the comparison with the analytic Transonic Flow model and previous hydrodynamic simulations. The interaction of the pellet ablation flow with the magnetic field is studied systematically for the first time. The major conclusion is that the change of of geometry from spherically symmetric to axially symmetric has a minor effect on the ablation rate in the case of purely hydrodynamic models. However, in the magnetohydrodynamic simulations the magnetic field channels the flow into an extended plasma shield, which can significantly reduce the ablation rate depending on the time it takes for the heat flux to ramp up. Shorter "warm-up" times lead to narrower ablation channels, stronger shielding, and reduced ablation rates. We will discuss how these results connect with previous pellet injection experiments and future experiments on ITER.