In this paper, the magnetic nanoparticles are injected into a water-oil, two-phase system under the influence of an external permanent magnetic field. We lay down the mathematical model and provide a set of numerical exercises of hypothetical cases to show how an external magnetic field can influence the transport of nanoparticles in the proposed two-phase system in porous media. We treat the water-nanoparticles suspension as a miscible mixture, whereas it is immiscible with the oil phase. The magnetization properties, the density, and the viscosity of the ferrofluids are obtained based on mixture theory relationships. In the mathematical model, the phase pressure contains additional term to account for the extra pressures due to fluid magnetization effect and the magnetostrictive effect. As a proof of concept, the proposed model is applied on a countercurrent imbibition flow system in which both the displacing and the displaced fluids move in opposite directions. Physical variables, including waternanoparticles suspension saturation, nanoparticles concentration, and pore wall/throat concentrations of deposited nanoparticles, are investigated under the influence of the magnetic field. Two different locations of the magnet are studied numerically, and variations in permeability and porosity are considered.