We present IRAM 30m and JCMT observations of HDO lines towards the solar-type protostar IRAS 16293-2422. Five HDO transitions have been detected on-source, and two were unfruitfully searched for towards a bright spot of the outflow of IRAS 16293-2422. We interpret the data by means of the Ceccarelli, Hollenbach and Tielens (1996) model, and derive the HDO abundance in the warm inner and cold outer parts of the envelope. The emission is well explained by a jump model, with an inner abundance of 1e-7 and an outer abundance lower than 1e-9 (3 sigma). This result is in favor of HDO enhancement due to ice evaporation from the grains in theinner envelope. The deuteration ratio HDO/H2O is found to be f_in=3% and f_out < 0.2% (3 sigma) in the inner and outer envelope respectively and therefore, the fractionation also undergoes a jump in the inner part of the envelope. These results are consistent with the formation of water in the gas phase during the cold prestellar core phase and storage of the molecules on the grains, but do not explain why observations of H2O ices consistently derive a H2O ice abundance of several 1e-5 to 1e-4, some two orders of magnitude larger than the gas phase abundance of water in the hot core around IRAS 16293-2422.