Hydrogen is an energy carrier that can be a sustainable solution for alternative energy with zero greenhouse gas emissions. Hydrogen storage is a key point for hydrogen energy. Metals provide an access for safe, controlled and reversible hydrogen storage and release. Magnesium, due to its outstanding hydrogen storage capacity, high natural abundance, low cost and non-toxicity is one of the most attractive materials for hydrogen storage. The economic efficiency of Mg as a hydrogen accumulator is limited by its sluggish hydrogen sorption kinetics and high stability of its hydride MgH2. Many attempts have been made to overcome these shortcomings. On a microscopic level, hydrogen absorption by metal is a complex multistep process that is impossible to survey experimentally. Theoretical studies help to elucidate this process and focus experimental efforts on the design of new effective Mg-based materials for hydrogen storage. This review reports on the results obtained within a density functional theory approach to studying hydrogen interactions with magnesium surfaces, diffusion on Mg surfaces, into and in bulk Mg, as well as hydrogen induced phase transformations in MgHx and hydrogen desorption from MgH2 surfaces.