It comes from the Miraculous Medal, which is a small medal often worn by Catholics. In 1830, a young French nun named Catherine Labouré had several visions of Mary. In one of these visions, she saw Mary standing on a globe with a snake (Satan) under her feet. Around the image of Mary, Catherine saw the words “O Mary, conceived without sin, pray for us who have recourse to you.” Mary asked Catherine to have medals made in her likeness, telling Catherine that those who wore the medal and confidently prayed the prayer on it would receive great graces. It’s come to be called the Miraculous Medal because some who wear it prayerfully have reported what they claim to be miraculous occurrences.
The Miraculous Medal is one of those Catholic traditions that is easy to misunderstand. To regard it as a “magic charm,” as many do, is to ignore the fact that it is nothing without faith and prayer. The prayer itself is notable for two things: 1), it is a statement of the Immaculate Conception (the Catholic belief that Mary was conceived without sin); and 2), it is a reminder that when we pray to Mary, we are recognizing her as an intercessor on our behalf, not as the source of grace herself (note that the medal asks Mary to “pray for us,” not to get in and magically fix things herself).
Incidentally, I’m wearing a necklace of the Miraculous Medal as I write this. I don’t wear it every day, but sometimes, when I need the reminder that there’s a heavenly mom pulling for me, I put it on. For many Catholics throughout the decades, it’s been just that: an extra source of comfort, and a tangible reminder that Mary will pray for us anytime we ask.