Ethanol is used in DNA extraction to force the DNA to precipitate in a solution. In order to collect a DNA sample, cells are broken down through agitation, then mixed with water, salt and ethanol to create an aqueous solution. Ethanol and salt work to prevent the DNA from dissolving into the water, instead causing it to precipitate out so it can be separated and extracted using a centrifuge.
Without the addition of either ethanol or another alcohol like isopropanol, DNA will dissolve in water. This is because nucleic acids (like DNA) are hydrophilic, meaning they bond easily with H2O molecules. Salt, which is used along with ethanol to force DNA to precipitate, interacts with DNA molecules to make it much less hydrophilic. Ethanol makes it easier for this interaction to take place.
DNA is hydrophilic because of the negatively charged phosphate groups found along its sugar phosphate backbone. These negatively charged phosphate groups interact with positively charged hydrogen atoms in the water molecules. Salt blocks this process. When dissolved in water, one of salt's products is Na+, a positively charged sodium ion. These positively charged sodium ions neutralize the negative charge of DNA's phosphate groups.
Water alone is not sufficient to allow the interaction between the sodium ions and phosphate groups to take place, as water blocks the electrostatic attraction between the two. Ethanol allows this interaction to happen, allowing the sodium ions to shield the negative phosphate groups and causing the DNA to precipitate out of the solution.