Yes, assuming that the condom has not broken, if someone ejaculated while wearing one the condom would prevent unwanted substances like semen from entering the other person's body. Some people still prefer to combine condoms with the withdrawal method to add another layer of protection.