In this article, we have studied the size effects on the thermodynamic stability of MgH2 nanowires as well as the size dependencies on the energetic stability and electronic states of magnesium and MgH2 nanowires using first-principles density functional theory. It is found that both magnesium and MgH2 nanowires become less stable as the diameter decreases. The desorption enthalpies were calculated to be −20.64, 34.54, and 61.86 kJ/mol H2 for the nanowires of A1_MgH2 (ϕ0.68 nm), A2_MgH2 (ϕ0.85 nm), and A3_MgH2 (ϕ1.24 nm), which were derived from the nanowires of A1_Mg (ϕ0.32 nm), A2_Mg (ϕ0.71 nm), and A3_Mg (ϕ1.04 nm), respectively. This result shows that a destabilization occurs in the dehydrogenation enthalpy as the diameters of Mg/MgH2 nanowires are reduced. In particular, a desorption enthalpy of 34.54 kJ/mol H2 for A2_MgH2 nanowire corresponds to an ambient-close desorption temperature of 264.25 K, indicating that nanocrystallization is a good way to achieve practical application of Mg-based hydrogen storage materials. In addition, the morphologies and sizes of magnesium and magnesium hydride have a remarkable effect on their electronic structure. Furthermore, for nanowire topology of Mg, a hydrogen enriched state is thermodynamically possible, yielding a hydrogen storage gravimetric density up to 8.8 wt %, which is of interest for hydrogen storage.