Ethical subroutines are a programmatic method to describe the characteristics by which artificial lifeforms, like Lieutenant Commander Data or Lore; and holograms, like The Doctor, determine what is ethically right and wrong.
In 2369, Lore disabled Data's ethical subroutines and made him perform dangerous experiments on the Borg and Geordi La Forge. With no moral obligation to his friend, Data no longer cared if he hurt La Forge. (TNG: "Descent, Parts I and II")
The crew of the USS Equinox disabled their EMH's ethical subroutines so that he would not object to killing sentient lifeforms to increase the Equinox's warp power. The Doctor's ethical subroutines were also disabled, and, in his altered state, he extracted information from Seven of Nine's Borg implants. After his ethical subroutines were restored, the Doctor apologized to Seven, but she assured him she bore him no ill will, and offered to help him modify his program so that future attempts to tamper with it would be much more difficult. (VOY: "Equinox, Part I" and "Part II")