The person who hears this should stop the wife immediately and remind her that it is inappropriate. Then, if possible, try to protect the privacy of the girlfriend by not spreading the story further.
If you are the girlfriend in this situation, you should have a serious conversation with the wife. Let her know that her behavior has violated your privacy and made you uncomfortable. And ask her to refrain from doing such things in the future. If you are someone else who heard it, you could also privately talk to the wife about the inappropriateness of it.
Talk to her calmly and explain why you think it's inappropriate. Maybe she doesn't realize how it makes you feel or what the implications are in a relationship. You can also suggest other positive topics to focus on, like your future plans together or the good memories you've shared.
You could start by having an open and honest conversation with her about how you feel. Let her know if it makes you uncomfortable or if you're okay with this new level of sharing.
You should firmly tell him that you find it inappropriate and ask him not to do it again. Set clear boundaries about what is acceptable in your relationship.
Tell her directly that this is unacceptable. You can say that you value privacy in your relationship and her sharing sex stories goes against that. Try to make her understand the potential consequences, such as making others uncomfortable or causing damage to your relationship's reputation. Maybe also give her some examples of more positive and appropriate things to share instead, like your recent adventures together or interesting things you've learned.
You can start by showing interest. For example, say something like 'That sounds really interesting. Tell me more.'
You should listen attentively. It shows that she trusts you with her imaginative thoughts.
One should ignore it. It is likely to be a malicious rumor, and by not giving it any attention, you are not helping to spread it further.
It's highly inappropriate. A wife should respect the privacy of her girlfriend. Such stories often involve very personal and private aspects of someone's life. Moreover, this kind of sharing may also cause discomfort and harm to others involved, and it can damage relationships not only between the wife and the girlfriend but also with other people who might hear the story.
If a coworker does this, it's important to firmly and immediately tell them that such behavior is unacceptable. For example, you could say 'Your stories are inappropriate and I don't want to hear them.'
She should immediately confront him and tell him how wrong and hurtful his behavior is.