You can purchase a pre-payment card in any "estanco" as madridmanjim says. But those are Telefonica cards and they will only work at Telefonica payphones.
There is a place in C/ Montera, where you can get also pre-payment cards through another company. Those don´t come with a chip to be inserted in the payphone, but have a personal code to activate them and then you dial a loooooooooong number to access that company and call your family.
Those are really cheap but I remember using them once and not getting a really good connection.
_________________________
Life is not fair, it is only fairer than death
William Golding