In this tale, the Wife of Bath tells of a knight who saw a young woman and raped her. When King Arthur heard about this, he was extremely angry and he ordered that the knight should be executed. But then the queen intercedes with King Arthur. She persuades him that he should not have the knight executed right away.
So King Arthur lets the queen have her way -- he gives her the knight and lets her decide. What she tells the knight is that he has to go out and figure out what it is that women want. Here is a quote to that effect:
I’ll grant you life if you can tell to me
What thing it is that women most desire.
Be wise, and keep your neck from iron dire!
And if you cannot tell it me anon,(50)
Then will I give you license to be gone
A twelvemonth and a day, to search and learn
Sufficient answer in this grave concern.
I believe that she is doing this because his crime is one that shows that he does not really care about women. So his punishment is to be forced to really care about women and find out what they are really like. In that way, it's a pretty fitting punishment.
After the knight forced himself on the maiden, people demanded justice, and he was to be put to death. However, the queen and other ladies intervened, and the king spared the knight and handed him over to the queen to do as she wished. The queen asked the knight to state what women desired the most. The queen also offered the knight time to conduct his research and report back with his answer. Life and death depended on the answer that the knight would provide. His sentence was revised, and he was given a chance to redeem himself. The knight talked to many different women in hopes of finding a definitive answer to the queen’s questions, but the answers he received were not conclusive. He gave up the quest and was ready to face his demise before he met a woman who helped him. His punishment was to find the answer to the question.