The purpose of the present work is to perform a numerical simulation study of the effect of magnetic field on transient laminar natural-convection heat transfer inside an enclosure. In our formulation of nonlinear governing equations, mass, momentum, energy and induction equations are applied to the enclosure. A finite volume code based on PATANKAR's SIMPLER method is utilized. Results are obtained for Rayleigh number (Ra) 7times105 and different Hartmann numbers (Ha) at various times while the Prandtl number is constant (Pr=0.733). Results show that initially fluid near the hot wall is activated and two convection cells appear near the cold and hot walls, but disappear as time passes. Also in the beginning the isotherms are almost parallel lines. For sufficiently large magnetic field strength the convection is suppressed and average Nusselt number decreases with an increase of Hartmann number and hence a magnetic field can be used as an effective mechanism to control the convection in an enclosure.