We perform density-functional calculations on the influence of external electric fields and electrons or holes injected into surface states on the relative stability of c(4x2) and p(2x2) reconstructed Si(001) surfaces. It is shown that an electric field parallel to the [001] direction or the insertion of electrons into surface states favors the formation of p(2x2) periodicities. Our results explain recent experimental studies reporting changes of surface reconstruction of Si and Ge(001) surfaces induced by the scanning tunneling microscope and the occurrence of p(2x2) reconstructions on (001) surfaces of n-doped Si.