In this paper, the magnetic field effects on natural convection of power-law non-Newtonian fluids in rectangular enclosures are numerically studied by the multiple-relaxation-time (MRT) lattice Boltzmann method (LBM). To maintain the locality of the LBM, a local computing scheme for shear rate is used. Thus, all simulations can be easily performed on the Graphics Processing Unit (GPU) using NVIDIA's CUDA, and high computational efficiency can be achieved. The numerical simulations presented here span a wide range of thermal Rayleigh number (10(4) <= Ra <= 10(6)), Hartmann number (0 <= Ha <= 20), power-law index (0.5 <= n <= 1.5) and aspect ratio (0.25 <= AR <= 4.0) to identify the different flow patterns and temperature distributions. The results show that the heat transfer rate is increased with the increase of thermal Rayleigh number, while it is decreased with the increase of Hartmann number, and the average Nusselt number is found to decrease with an increase in the power-law index. Moreover, the effects of aspect ratio have also investigated in detail.