The title of Shakespeare's Measure for Measure is derived from the Bible, specifically the Sermon on the Mount, where Jesus says "Judge not, that ye be not judged. For with what judgment ye judge, ye shall be judged: and with what measure ye mete, it shall be measured to you again" (Matt. 7.1-2 KJV).
The meaning of the title doesn't become clear until very near the end of the play.
At the beginning of the play, Angelo, the Duke of Vienna's deputy who's in charge of the city of in the Duke's absence, has young Claudio arrested for having sexual relations with his fiancée, Juliet, who is now with child, and condemns Claudio to death according to an old Viennese law.
Claudio arranges for his sister, Isabella, a postulant at the convent, to meet with Angelo to intercede on Claudio's behalf. Angelo takes advantage of the situation, and offers to spare Claudio's life if Isabella will have sexual relations with him.
The Duke, disguised as a monk, arranges for Angelo's former fiancée, Marianna, to take Isabella's place at the arranged time and place. Angelo believes that Isabella has succumbed to his lustful desires, but he nevertheless fears public exposure of what he's done. Angelo breaks his promise to Isabella to release Claudio, and instead orders Claudio's execution be carried out.
In due time, Angelo's reprehensible behavior is exposed, and Claudio is saved from execution.
The Duke comes forward to condemn Angelo, and to sentence him to death—appropriately, measure for measure—for the same reasons Angelo sentenced Claudio to death.
ANGELO. The very mercy of the law cries out
Most audible, even from his proper tongue,
“An Angelo for Claudio, death for death.”
Haste still pays haste, and leisure answers leisure;
Like doth quit like, and measure still for
Then, Angelo, thy fault’s thus manifested,
Which, though thou wouldst deny, denies thee
We do condemn thee to the very block
Where Claudio stooped to death, and with like
Away with him... (5.1.463-475)
To everyone's surprise, however, Mariana appeals to the Duke to pardon Angelo, and she's joined in her appeal by Isabella. The Duke withdraws his sentence of death against Angelo, but orders Angele to marry Mariana to honor the vow he made to her many years ago.
The irony of the title of the play is that although the Duke duly enacted punishment against Angelo, measure for measure, Angelo was pardoned through the intersession of Mariana and Isabella, two of the people he had most offended.