How long do you have to take the pill for it to be effective?

Which pill? It would depend on the pill you are taking.
? BC ? If you are referring to birth control pill it varies. It works by stopping egg release & it does take time for your body to synchronize with the hormones in the pil.Many manufacturers suggest you are safe after a week or two, but most OB's suggest you use backup BC (condom,foam,etc) for the first month after starting.