The title of Measure for Measure is taken from the Bible: "Judge not, that you be not judged. For with the judgment you pronounce you will be judged and the measure you give will be the measure you get" (Matthew 7.1 and 7.2). This quotation from Christ's Sermon on the Mount, stating generally that each individual will be judged as harshly as he has judged others, implies that mercy and human sympathy should temper justice.
In Mark, the thought is expressed again: "And he said to them, 'Take heed what you hear; the measure you give will be the measure you get, and still more will be given you'" (Mark 4.24).
It is interesting to note that the phrase also appears in one of Shakespeare's earlier plays, King Henry VI, Part 3: "Measure for measure must be answered" (II. vi. 55).