Why did Jesus say, "Do not touch me"? John 20:17: 


  Jesus said, "Do not touch me, for I have not yet returned to the Father. Go instead to my brothers and tell them, 'I am returning to my Father and your Father, to my God and your God.'"


Why did Jesus not want Mary to touch him, remembering that he allowed Thomas to touch him before he went to heaven?
The reason Jesus said this has been the subject of debate. One common belief is that He didn't want her to tarry there, that it was more of a "now is not the time" statemen. Example:


  Clarke's Commentary on the Bible
  
  Touch me not - Μη μου ἁπτου, Cling not to me. Ἁπτομαι has this sense
  in Job 31:7, where the Septuagint use it for the Hebrew דבק dabak,
  which signifies to cleave, cling, stick, or be glued to. From Matthew
  28:9, it appears that some of the women held him by the feet and
  worshipped him. This probably Mary did; and our Lord seems to have
  spoken to her to this effect: "Spend no longer time with me now: I am
  not going immediately to heaven - you will have several opportunities
  of seeing me again: but go and tell my disciples, that I am, by and
  by, to ascend to my Father and God, who is your Father and God also.
  Therefore, let them take courage."


Another view:


  Vincent's Word Studies
  
  Touch me not (μή μοῦ ἅπτου)
  
  The verb, primarily, means to fasten to. Hence it implies here, not a
  mere momentary touch, but a clinging to. Mary thought that the old
  relations between her Lord and herself were to be renewed; that the
  old intercourse, by means of sight, sound, and touch, would go on as
  before. Christ says, "the time for this kind of intercourse is over.
  Henceforth your communion with me will be by faith through the Spirit.
  This communion will become possible through my ascending to the
  Father."


And another, similar to the others, but emphasizing "There are other things to do right now".


  People's New Testament
  
  20:17 Touch me not. She was probably about to clasp his feet. She is
  told to discharge a higher duty: to go to the brethren with the glad
  story.