A) The baby will die anyways, probably in a worse way (the Nazis likely have little interest in quick/painless).
B) You will live if the baby dies now.
C) Other lives are also at stake. How many others are hiding with you is unknown.
So fighting the Nazis is noble, but the ultimate outcome is several lives lost, including the baby's, as opposed to only the baby. From a utilitarian perspective, killing the baby is obviously the right thing to do. From a Kantian or moral absolutist's perspective, you have to let the baby live.
Of course, it also depends on HOW likely you are to be heard/discovered.