This phrase comes from the verb valor.
Me vale madre is a way of saying "I don't give a damn". Actually, it's stronger than that, more like "I don't give a shit/fuck".
Here's a quick chart:
Te vale madre = You don't give a shit
Le vale madre = He/She doesn't give a shit
Nos vale madre = We don't give a shit
Les vale madre = They don't give a shit
There are times when you don't need such a strong response, in which case you can drop the "madre" and say "me vale", which simply means "I don't care". You can also say "no me importa". Think of it as:
Me vale = no me importa = I don't care.
That's it! If you speak enough Spanish, sooner or later you're going to come across this, it's actually quite common.
Before I go, let me say that madre is a very strong word in Spanish, at least in Mexican Spanish. There are plenty of ways to use this word, and we'll be looking at those later.