The problem of DNA-DNA interaction mediated by divalent counterions is studied using computer simulation. Although divalent counterions cannot condense free DNA molecules in solution, we show that if DNA configurational entropy is restricted, divalent counterions can cause DNA reentrant condensation similar to that caused by tri- or tetra-valent counterions. DNA-DNA interaction is strongly repulsive at small or large counterion concentration and is negligible or slightly attractive for a concentration in between. Implications of our results to experiments of DNA ejection from bacteriophages are discussed. The quantitative result serves to understand electrostatic effects in other experiments involving DNA and divalent counterions.