“I did not know where they came from.” To the leaders of Jericho, what Rahab the prostitute said was a plausible statement. Jericho was on both a major north-south trade route and a major east-west route, so it is likely that lots of men came through, and Rahab would not know a lot about many of them, especially if they were not fluent in the local language.
This verse and others like it (cp. Exod. 1:15-20) reveal an ethical standard for what is a “lie,” or at least that there are times when lying is acceptable. God does not require us to give the accurate facts (“the truth”) to someone who will use them to harm us or God’s people. It is certainly good to give accurate facts when we can. Furthermore, this concept can and does get abused because there are times when people’s intentions are not clear, the circumstances are not easily discerned, or people just lie to protect themselves when they ought to tell the truth and deal honestly with the situation they are in. However, there are clear cases, such as here, where a “lie” is the will of God.