"You are right when you say you have no husband. ..." (John 4:17-18)

"The fact is, you have had five husbands, and the man you now have is not your husband. What you have just said is quite true." (John 4:17-18)
Here Jesus is responding to the woman's answer:
“I have no husband,” she replied. (John 4:17)
Jesus is showing the woman that he has the ability to know her past. This is to show her that God has empowered Jesus. Jesus is not a showman. He is simply trying to bring attention to the teachings that God has instructed him to teach. In order to do so, he had to show some people some of the power God had given him.

This is evidenced by the fact that following Jesus' statement, the woman said:
“Sir,” the woman said, “I can see that you are a prophet." (John 4:19)
The ability to know that the woman had five previous husbands, and her current boyfriend is not her husband illustrates to the woman that Jesus has been given extraordinary power.

Is Jesus God?

Does this mean that Jesus is the Supreme Being, as many sectarian teachers claim? Certainly not. God can give authority and power. Jesus, as we see in so many of his other statements, always admitted himself to be God's servant and representative:
"For I have come down from heaven not to do my will but to do the will of Him who sent me." (John 6:38)
Doing God's will means serving God. It means lovingly wanting to please Him. That is the prime definition of a loving servant.

As we'll see in the next statement, Jesus' purpose for showing his abilities is in an attempt to bring the Samaritan woman back home to her loving relationship with God. This is the clear definition of "being saved."