Joshua 2:2-3 The king of Jericho was told, "Look! Some of the Israelites have come here tonight to spy out the land." So the king of Jericho sent this message to Rahab: "Bring out the men who came to you and entered your house, because they have come to spy out the whole land."
Apparently Jericho has its own group of agents looking out over the city because word gets out to the king that the spies were in town and they were "staying" with Rahab. Now everyone knew that Rahab was a prostitute - it would not seem unlikely to the king that she would have men in her room and not know why they had come into the city. She was simply working. Which is why the king sends message to her doorstep and politely request she send the men out.
Rahab is faced with a situation. She could give up the spies - She could ask the king for money to give him the spies - She could blackmail the spies into giving her money not to give them up. If we were to watch a movie, and the character was a prostitute - wouldn't one of these choices be what we'd expect of a character with this background.
That's the problem we have as sinners. Satan is working hard for you to get discouraged as a Christian by either trying to live up to what people expect of you, or live down what people already know about you. If we let Satan make us think that we are not worthy to share God's gospel, then we will be beaten. The truth is, none of us are worthy, that's where Jesus comes in. It is only through Jesus that we can even begin to get through this time with any hope. So be Strong and Courageous - as God calls His people to be.