Background Three pregnancies with male offspring in one family were complicated by severe polyhydramnios and prematurity. One fetus died; the other two had transient massive salt-wasting and polyuria reminiscent of antenatal Bartter's syndrome. Methods To uncover the molecular cause of this possibly X-linked disease, we performed whole-exome sequencing of DNA from two members of the index family and targeted gene analysis of other members of this family and of six additional families with affected male fetuses. We also evaluated a series of women with idiopathic polyhydramnios who were pregnant with male fetuses. We performed immunohistochemical analysis, knockdown and overexpression experiments, and protein-protein interaction studies. Results We identified a mutation in MAGED2 in each of the 13 infants in our analysis who had transient antenatal Bartter's syndrome. MAGED2 encodes melanoma-associated antigen D2 (MAGE-D2) and maps to the X chromosome. We also identified two different MAGED2 mutations in two families with idiopathic polyhydramnios. Four patients died perinatally, and 11 survived. The initial presentation was more severe than in known types of antenatal Bartter's syndrome, as reflected by an earlier onset of polyhydramnios and labor. All symptoms disappeared spontaneously during follow-up in the infants who survived. We showed that MAGE-D2 affects the expression and function of the sodium chloride cotransporters NKCC2 and NCC (key components of salt reabsorption in the distal renal tubule), possibly through adenylate cyclase and cyclic AMP signaling and a cytoplasmic heat-shock protein. Conclusions We found that MAGED2 mutations caused X-linked polyhydramnios with prematurity and a severe but transient form of antenatal Bartter's syndrome. MAGE-D2 is essential for fetal renal salt reabsorption, amniotic fluid homeostasis, and the maintenance of pregnancy. (Funded by the University of Groningen and others.).