According to The Tech Museum of Innovation, DNA is soluble in water because the sugar and phosphate molecules that make up the DNA backbone are hydrophilic. DNA bases are hydrophobic but are protected from the water by the DNA backbones of the two DNA strands.
In order for a molecule to be soluble in water, it needs to be a polar molecule or have a charge. H2O is a bent molecule with the oxygen located in the middle. Oxygen is more electronegative than hydrogen, so it attracts the electrons more strongly, resulting in a partial charge difference between the oxygen and hydrogen atoms. These charge differences cause the hydrogen and oxygen of different water molecules to be transiently attracted to one another in hydrogen bonds.
Polar molecules have atoms that are able to form hydrogen bonds, typically hydroxyl (-OH) or carbonyl (C=O) groups. The DNA backbone consists of alternating ribose (sugar) and phosphate molecules. Phosphate is negatively charged, which is why DNA macromolecules are predominately negative. Ribose has multiple hydroxyl groups that are able to form hydrogen bonds with water.
Interestingly, the twist in double-stranded DNA is caused by the bases of DNA being hydrophobic while the backbones are hydrophilic. The twist compresses the bases closer together and prevents water from getting into the middle of the molecule.