There is very little in the gospels or the rest of the New Testament that tell us about the risks that Mary took. However, we can identify some risks that seem significant.
The major risk that Mary took was in accepting (assuming that she could have declined) the charge of becoming the mother of Jesus. This is surely a daunting assignment that would give anyone pause. It would have been even more difficult, perhaps, to tell Joseph about her pregnancy. This was not a time and place in which a woman could lose her virginity (or appear to lose it in Mary’s case) before marriage without fear of repercussions. Mary was taking a risk by staying betrothed to Joseph and telling him that she was pregnant. It surely was frightening for a young woman to tell a man that in those days.
Mary took something of a risk in travelling from Nazareth to Bethlehem when she was so heavily pregnant. Even though she surely had faith that God would protect her, it would have been a very uncomfortable and frightening thing to do. Mary also took a risk by keeping Jesus with her and fleeing to Egypt when she heard of Herod’s plan to kill the children. Finally, we can say that Mary was taking a risk by continuing to stay near her son when he was preaching and when he eventually was executed. It would surely have been frightening to openly remain connected to someone who was making the authorities so upset.
Of all of these, however, surely the simple act of agreeing to become the mother of God’s son was a huge risk just because it was something so far out of the realm of what any person would think normal.