The Virgin Mary told St. Catherine Labouré to have a medal struck. It is “for each one of us a sure sign of [her] affection for us and a constant reminder of our duties toward [her]” (from the Act of Consecration to Our Lady of the Miraculous Medal). It reminds us of the graces that the Blessed Virgin obtains for those who ask them of her.
It took 2 years before the medal began to be produced. It was originally called the Medal of the Immaculate Conception, but because so many miracles were reported by those wearing it, it became known as the Miraculous Medal.
Part of a video from the Daughters of Charity International: