Castor oil??

So I’ve always thought castor oil was bad to use. I’d still never use it but out of curiosity I asked my doctor and she said “it is a laxative for you, not your baby, so no it won’t hurt her.” I mean it’s not worth the risk but why would she say this?