ALMA observations of water deuteration: a physical diagnostic of the formation of protostars