What does John 4:18 mean?
In other contexts, this might seem like a blunt, even harsh description of the woman's sin. Jesus' words are direct and to the point. And they clearly are meant in response to her carefully phrased claim to not have a husband. Rather than press the question further, Jesus simply tells the woman what He already knows: that she has lived, and is living, an immoral life.Christ's motivation for this is a basic principle of evangelism. Those who don't know they have a need cannot respond to that need. Jesus has already explained the difference between literal water and "living water." Now, He exposes the fact that this woman is a sinner. Matthew 13:20–21 mentions that "seeds" of the gospel can't take root in a heart made of hardened "soil." Confronting a person with her specific sins is one way to make her understand her need for a Savior, and to break up that soil.
The dialog here reads like a summary, not a word-for-word transcript. It's possible that Jesus described additional specific details about her past. Given what the woman tells the other Samaritans—that Jesus knew "everything" she had done—this is more likely than not (John 4:39). And yet, Jesus mentions these sins not simply to shame her, or even "just" to make her understand her own sin. The fact that Jesus not only knows that the woman is living in sin, but knows specific details of her sin, is crucial to understanding the rest of the conversation.
Jesus is also putting His upcoming statement about those whom God seeks in context. Jesus sought out this conversation, even though He knew that she was an immoral, outcast Samaritan woman. God seeks sinners, even though He knows exactly how depraved we really are. When Jesus says God is "seeking such people," that includes this woman, who has been an outcast among outcasts.