In this research, heat transfer analysis was operated by simulation to investigate the influence of carbon nanotubes (CNTs) on laser absorption and molten pool characteristic as well as the vaporization porosity of a typical magnesium alloy of AZ31B in the selective laser melting (SLM) process. It is concluded that the laser absorption is enhanced by 7.9% through mixing 1.5 wt% CNTs into AZ31B alloy powders. The full melting state of molten pools for CNTs/AZ31B composites was achieved by laser input energy densities (LIEDs) larger than 42 J/mm3. However, vaporization porosity has an ascendent tendency with LIED increasing, which leads to poor densities of manufactured parts. As a result, the optimal relative density and mechanical properties of composites are obtained by an LIED of 42 J/mm3. It may solve the problem of low laser absorption in laser processing for magnesium alloys and provide a referenced method to evaluate the vaporization porosity of the material in the SLM process.