ATP binding cassette (ABC) proteins belong to a superfamily of active transporters. Recent experimental and computational studies have shown that binding of ATP to the nucleotide binding domains (NBDs) of ABC proteins drives the dimerization of NBDs, which, in turn, causes large conformational changes within the transmembrane domains (TMDs). To elucidate the active substrate transport mechanism of ABC proteins, it is first necessary to understand how the NBD dimerization is driven by ATP binding. In this study, we selected MalKs (NBDs of a maltose transporter) as a representative NBD and calculated the free-energy change upon dimerization using molecular mechanics calculations combined with a statistical thermodynamic theory of liquids, as well as a method to calculate the translational, rotational, and vibrational entropy change. This combined method is applied to a large number of snapshot structures obtained from molecular dynamics simulations containing explicit water molecules. The results suggest that the NBD dimerization proceeds with a large gain of water entropy when ATP molecules bind to the NBDs. The energetic gain arising from direct NBD-NBD interactions is canceled by the dehydration penalty and the configurational-entropy loss. ATP hydrolysis induces a loss of the shape complementarity between the NBDs, which leads to the dissociation of the dimer, due to a decrease in the water-entropy gain and an increase in the configurational-entropy loss. This interpretation of the NBD dimerization mechanism in concert with ATP, especially focused on the water-mediated entropy force, is potentially applicable to a wide variety of the ABC transporters.