The moon probably had water when it first formed four and a half billion years ago, according to a new study.