I am 25 weeks pregnant, and was smoking marijuana until last week. How long does it take for the drug to get out of the baby's placenta or system?

Very long time. That drug could easily show up in the baby's bowels for the first few days after delivery. You are very unwise to abuse drugs during a pregnancy. Abusing drugs during pregnancy often results in the newborn being taken into protective custody. You should carefully consider your actions.
Thanks for quitting. Quitting is good news and should continue, if you value your baby's health. Otherwise, expect a smaller baby, smaller baby head, potential learning issues,etc. The cannabis is detectable in a new babies poo reflecting exposure as early as 12 wks. If you are not on the radar of CPS, they are unlikely to look. If you resume later, expect a higher risk of crib death and health problems for baby.
Fetal brain damage. Previous studies have found that exposure to marijuana during pregnancy can increase a child's risk of having cognitive deficits or psychiatric disorders. While it is not exactly clear how marijuana may affect the fetal brain at a molecular level, it seems the brain may be particularly sensitive to THC (delta-9-tetrahydrocannabinol) during early development, when neurons are forming critical connections. Any drug that interferes with this development could be detrimental to the child, Harkany said.