Adding spermicide to a barrier device to block or kill sperm can help prevent pregnancy. Spermicide gel or foam can be bought over the counter without a prescription.