There are a few, related reasons that the Blessed Mother, and not St. Joseph, is said to have "kept all these words, pondering them in her heart" (Lk. 2:19):
On the nativity, Fr. Réginald Garrigou-Lagrange, O.P., writes (Mother of the Saviour and Our Interior Life ch. 3):
Mary grew in humility, poverty and love of God by giving birth to her Son in a stable. His cradle was but a manger. But, by contrast, there were the angels there to sing “Glory to God in the highest; and on earth peace to men of good will.” Those words were sweet to the ears of the shepherds and of St. Joseph, and still more sweet to the ears of Mary. They were the beginning of a Gloria which the Church does not cease to sing at Mass while this world endures, and the liturgy of eternity has not yet replaced that of time.
It is said of Mary that she kept all these words, pondering them in her heart. Though her joy at the birth of her Son was intense, she treasured it up in silence. St. Elisabeth alone received her confidences. God’s greatest actions defy human expression. What could Mary say to equal what she had experienced?
St. Ambrose wrote (quoted in St. Thomas's Catena Aurea on St. Luke's Gospel):
Esteem not the words of the shepherds as mean and despicable: For from the shepherds Mary increases her faith, as it follows: Mary kept all these sayings, and pondered them in her heart. Let us learn the chastity of the sacred Virgin in all things, who no less chaste in her words than in her body, gathered up in her heart the materials of faith.
The third reason Fr. Cornelius à Lapide, S.J., gives in his Commentary on St. Luke, pp. 100-101, is
that in good time she might unfold all these things and narrate them in order to the apostles, and especially to S. Luke, who was destined to write of them. Observe here in the Virgin the rare example of maidenly silence and modesty,* of heavenly prudence, and of the firmest faith and hope, as she wonders at the present and waits for the future.
*cf. 1 Timothy 2:11:
Let the woman learn in silence with all subjection.
Her prompt, unquestioning, silent obedience to St. Joseph telling her they needed to flee to Egypt (Mt. 2:13-14) is another example of her womanly virtues.