It sarcastically refers to an absurd or impossible event, because pigs, of course, cannot fly. So when someone says something will happen "when pigs fly," they mean it’s never going to happen.
Equivalents
This is how you express this idiom across languages and locales.