Utilizing a two-temperature model, this study investigates the thermomagnetic convection of a ferrofluid within a porous cavity. The cavity is heated from the bottom and cooled from the sides to establish thermo-gravitational convection, whereas the thermomagnetic convection is induced by permanent magnets. The equations that govern flow and heat transfer are discretized using the finite volume method and the SIMPLE algorithm. The first part of the study evaluates the impact of the permanent magnet’s position on the flow pattern and ferrofluid and solid temperature fields. The results showed that positioning the magnet at the bottom of the cavity enhances heat transfer rate. The second part investigates the impact of the distance between two magnets at different magnetic, Rayleigh, and Darcy numbers, as well as the conduction ratio. The numerical findings exhibit that the heat transfer rate attains a peak at a certain distance between the magnets, depending on the Rayleigh number. With increasing Rayleigh number and conduction ratio, or decreasing Darcy number, the role of the magnetic field in improving heat transfer becomes less important. It is observed that thermomagnetic convection is replaced by thermo-gravitational one at high conduction ratios. The study emphasizes the need to use a local thermal non-equilibrium model in porous media with high magnetic and Darcy numbers, as well as large conduction ratios, to accurately capture the heat transfer phenomenon. It is observed that by placing two magnets at an appropriate distance, the heat transfer rate could be augmented by more than 136 %.