The spin-singlet ground states of a D − ion in bulk Si and Si/ SiO 2 quantum wells have been investigated in the presence of a magnetic field, using a diffusion quantum Monte Carlo method. By neglecting the central-cell correction, the negative donor state can be assigned by the valley indexes of two trapped electrons. In the bulk Si, the ground-state energies of negative donors of both the intervalley and intravalley configurations split into two levels in a magnetic field along the z axis and the lowest-energy state becomes the intervalley configuration of the two electrons in the valleys with their longitudinal axes perpendicular to the magnetic field. The magnetic field increases the binding energy of a negative donor and the strongest enhancement is attained for the intravalley configuration of the two electrons in the valley with the longitudinal axis parallel to the magnetic field. In the quantum well with the interface within the x-y plane, the quantum confinement effect changes the lowest-energy state of a negative donor from the intervalley configuration in the bulk to the intravalley configuration for which the binding energy is increased most strongly by the magnetic field perpendicular to the well interface. The central-cell correction on the binding energy of a D − ion in a quantum well is also discussed.