Birth control

If someone were pregnant but didn’t know yet and started taking birth control, would it affect the pregnancy?