Way to insult Virgin Mary. Italians use it when they are very angry or feel hard pain.
Similar expressions connected to the Virgin Mary are "Madonna Bocchinara", "Madonna Puttana".
Italian creativity is often shown in the creation of similar expressions.
Mi ha rubato le scarpe di gomma, porca madonna!