Are you in the third world where food is scarce? No?! Your doctor is then full of shit.
There are many challenges to nursing through a pregnancy. Supply drop, lack of let down, sore nipples, contractions when feeding. Most of the time it is perfectly safe to continue nursing as long as your toddler wants to continue.
I nursed DD all the way through my pregnancy with DS. I'm nursing DS now. Part of me hopes he will stop soon but if he doesn't I'll continue and will tandem nurse again.