Why didn't Mary tell Joseph what Gabriel had said to her? From Gabriel's visitation of Mary in Luke 1:26-38, ending with this famous line:


  "I am the Lord's servant," Mary answered. "May your word to me be
  fulfilled." Then the angel left her.


And also a dream Joseph was given from Matthew 1:18-25:


  But after he had considered this, an angel of the Lord appeared to him
  in a dream and said, "Joseph son of David, do not be afraid to take
  Mary home as your wife, because what is conceived in her is from the
  Holy Spirit. She will give birth to a son, and you are to give him the
  name Jesus, because he will save his people from their sins."


One of these visitations must have happened before the other and it's not clear to me which since they are from different authors of the Gospel. Are we to infer that Joseph did not relate this to Mary, and that she kept quiet as well? If so, why? I don't believe that either was asked to keep the visits to themselves.
If we look at the part from Matthew, it is clear that Mary knew she was pregnant, or was getting pregnant before Joseph did. Joseph thinks about putting her away before he has a dream where he is told to stay with her. Matthew 1:19:


  19 Then Joseph her husband, being a just man, and not willing to make
  her a public example, was minded to put her away privily


Joseph is thinking of putting her away because he is a just man, he knows the scripture that says in Deteronomy 22:22-27 that, at least Mary, is in trouble. 


  22 If a man be found lying with a woman married to an husband, then
  they shall both of them die, both the man that lay with the woman, and
  the woman: so shalt thou put away evil from Israel.
  23 If a damsel that is a virgin be betrothed unto an husband, and a
  man find her in the city, and lie with her;
  24 Then ye shall bring them both out unto the gate of that city, and
  ye shall stone them with stones that they die; the damsel, because she
  cried not, being in the city; and the man, because he hath humbled his
  neighbour's wife: so thou shalt put away evil from among you.
  25 But if a man find a betrothed damsel in the field, and the man
  force her, and lie with her: then the man only that lay with her shall
  die.
  26 But unto the damsel thou shalt do nothing; there is in the damsel
  no sin worthy of death: for as when a man riseth against his
  neighbour, and slayeth him, even so is this matter:
  27 For he found her in the field, and the betrothed damsel cried, and
  there was none to save her.


Mary might, very likely, have told Joseph about the visitation of Gabriel. If she told, it did not matter for Joseph to worry. He knew that the Law forbids Mary to have had sex before they are married. The thought of putting Mary away is because no one will believe that Mary was pregnant from the Holy Ghost (yet). This makes being pregnant for very dangerous for Mary, and perhaps also for Joseph.