Can custody be taken away from a mother who has to take prescription pain killers for a disease?

No. Not unless the state of your health prevents you from being able to properly care for your child(ren), or you are in someway not using the drug(s) as prescribed.