You can have a pet if you have Ranger as either your primary or secondary profession. Rangers are the only profession which can have permanent pets - and you'll have your pet with you as long as you have the "Charm Pet" skill on your bar.
Necromancers get to summon undead pets - however these pets get health degeneration and die off. They also need dead bodies so as to summon these undead pets. Necromancer's pets are not permanent, they do die off and they don't do area transitions with the necromancer either.