Not all species are currently able to get the undead effect.
Currently Berrok, Chimby, Leverene, Zenirix, Drindian, Intes, Kayoki, Valabex, Ardur, Meiko, Otachie, Roditore, Ahea, Draqua, Sirleon, and Tesuri are available and all of them can be viewed by going to creatu species under the information tag and selecting the undead effect in the effect box.
The pet also needs to be an adult.
It can be turned through resurrection (I'm not sure if it's definite or a random chance) or there is a chance of it turning if it is your active pet while trick or treating. The latter method usually takes a few tries, but if you keep trying it'll eventually work.