What if you're pregnant and take the pill?

.
Say I just got pregnant. If I go on birth control a week later, would it get rid of the fertilized egg?