Water (H2O) is one of the most abundant molecules in the interstellar medium. In addition to being a primordial ingredient in the emergence of life, this species plays an essential role in the process of star formation through the cooling of warm gas. It also controls the chemistry for many species, either in the gas phase or on the grain surfaces. Studying its deuterated form HDO is a unique opportunity, through the estimation of the HDO/H2O ratio, to constrain the mechanisms of water formation and to better understand the origin of water contained in terrestrial oceans. Indeed, recent results obtained with the Herschel satellite show that the HDO/H2O ratio observed in comets is similar to the value measured in oceans (~ 1.5 10-4), which suggests that comets could have brought a large fraction to Earth to form the oceans during heavy bombardments (Hartogh et al. 2011). In this thesis, I was interested in the study of deuterated water in the first stages of star formation, the Class 0 stage, which precede the formation of the protoplanetary disk leading to the birth of comets and planets. Through a 1D non-Local Thermodynamic Equilibrium radiative transfer modeling of the line profiles of the numerous HDO and H218O transitions detected with the HIFI (Heterodyne Instrument for Far-Infrared) instrument onboard the Herschel Space Observatory and ground-based telescopes (IRAM, JCMT), I determined that the HDO/H2O ratios of the solar-type protostar IRAS 16293-2422 was about 2% in the hot corino, the inner part of the protostellar envelope sufficiently warm (T > 100 K) to desorb in gas phase the water molecules trapped in the icy grain mantles, and about 0.5% in the colder part of the envelope. This study (Coutens et al. 2012) also allowed me to show that an absorbing layer rich in water surrounds the protostar. This layer could be produced by the photo-desorption through the UV field of the water molecules frozen on the grains, on the edges of the molecular cloud. The HDO/H2O ratios as well as the D2O/HDO ratios determined in IRAS 16293-2422 enable to constrain the conditions of water formation in this kind of objects and in particular suggest that water would be formed before the gravitational collapse of the cloud. This study was then extended to other solar-type protostars NGC1333 IRAS4A and NGC1333 IRAS4B, for which I estimated the abundances of deuterated water and noticed that an extended absorbing layer also surrounds these sources. The high HDO/H2O ratios determined in IRAS 16293-2422 suggest that mechanisms are required between the Class 0 stage and the comets formation to decrease these isotopic ratios. It is however necessary to study a larger sample of protostars to know if this trend is observed in most of the sources. The HDO abundances obtained in NGC1333 IRAS4A and NGC1333 IRAS4B will consequently be useful to estimate their HDO/H2O ratios. Finally, I also studied deuterated water in protostellar objects more massive and more luminous than solar-type protostars and show here the case of the ultra-compact HII region G34.26+0.15.