The magnetohydrodynamic (MHD) boundary-layer flow and heat transfer due to a shrinking sheet in a porous medium is considered for the first time. The Navier-Stokes equations and the heat equation are reduced to two nonlinear ordinary differential equations via similarity transformations. The transformed equations are solved by a semi-analytic method. The effects of the suction and porosity parameters, the Prandtl and Hartmann numbers on the skin friction, heat transfer rate, velocity and temperature profiles are discussed and presented, respectively.