Now, notice it does not say that it is OK to lie in these situations! You can be silent, which would bear consequences for yourself in the fact that the soldiers would still come in. Or the conversation could go something like this:
Soldier: Do you have any Jewish families in this house? Tell us the truth, or you will all be taken away to Auschwitz!
Person: No, there are no Jews here! You look hungry soldier, would you care to have a small pastry?
This person did not lie. In fact, he was refering to the exact spot he and the soldier were standing on. He was using discreet language (even though the soldier did not know that). So he was telling the truth. It would be different if he said In this house (which would be lying) instead of here. And he also distracted the soldier further by changing the subject.
So, it is possible to not lie in these situations. But then again, if you did, it would be with minimal fault, and would not be mortal sin (although it would still be a small venial sin, as lying is intrinsically evil, and a person cannot commit a bad act, even if the intention is good.)