Geometric distortion induced by the main B0 field disrupts the consistency of fetal echo planar imaging (EPI) data, on which diffusion and functional magnetic resonance imaging is based. In this paper, we present a novel data-driven method for simultaneous motion and distortion correction of fetal EPI. A motion-corrected and reconstructed T2 weighted single shot fast spin echo (ssFSE) volume is used as a model of undistorted fetal brain anatomy. Our algorithm interleaves two registration steps: estimation of fetal motion parameters by aligning EPI slices to the model; and deformable registration of EPI slices to slices simulated from the undistorted model to estimate the distortion field. The deformable registration is regularized by a physically inspired Laplacian constraint, to model distortion induced by a source-free background B0 field. Our experiments show that distortion correction significantly improves consistency of reconstructed EPI volumes with ssFSE volumes. In addition, the estimated distortion fields are consistent with fields calculated from acquired field maps, and the Laplacian constraint is essential for estimation of plausible distortion fields. The EPI volumes reconstructed from different scans of the same subject were more consistent when the proposed method was used in comparison with EPI volumes reconstructed from data distortion corrected using a separately acquired B0 field map.