13 When Joshua was by Jericho, he lifted up his eyes and looked, and behold, a man was standing before him with his drawn sword in his hand. And Joshua went to him and said to him, "Are you for us, or for our adversaries?"
14 And he said, "No; but I am the commander of the army of the LORD. Now I have come." And Joshua fell on his face to the earth and worshiped and said to him, "What does my lord say to his servant?"
15 And the commander of the LORD's army said to Joshua, "Take off your sandals from your feet, for the place where you are standing is holy." And Joshua did so.
Before Joshua conquers Jericho, he encounters Christ in a form prior to that of how he came to earth to be the child of Mary and Joseph. This is called the pre-incarnate Christ. We know this is definitely God standing before him because he worships the being and he is told that the ground is holy.
Whenever an angel of God is worshipped in the bible, he tells the person worshipping to stop because the angel is not God (who is the only one deserving of worship). This being not only doesn't stop the worship, but he encourages it by demanding the ground where he walks to be treated as holy.
It is worth noting that this is a similar encounter to that of Moses and the burning bush. This parallel adds to our confidence in Joshua as Moses successor and a prophet in the same way that Moses was.