In magnetic resonance electrical impedance tomography (MREIT), we try to reconstruct a cross-sectional resistivity (or conductivity) image of a subject. When we inject a current through surface electrodes, it generates a magnetic field. Using a magnetic resonance imaging (MRI) scanner, we can obtain the induced magnetic flux density from MR phase images of the subject. We use recessed electrodes to avoid undesirable artefacts near electrodes in measuring magnetic flux densities. An MREIT image reconstruction algorithm produces cross-sectional resistivity images utilizing the measured internal magnetic flux density in addition to boundary voltage data. In order to develop such an image reconstruction algorithm, we need a three-dimensional forward solver. Given injection currents as boundary conditions, the forward solver described in this paper computes voltage and current density distributions using the finite element method (FEM). Then, it calculates the magnetic flux density within the subject using the Biot-Savart law and FEM. The performance of the forward solver is analysed and found to be enough for use in MREIT for resistivity image reconstructions and also experimental designs and validations. The forward solver may find other applications where one needs to compute voltage, current density and magnetic flux density distributions all within a volume conductor.