Pets in MapleStory are bought from the Cash Shop using NX, the game's premium currency, which is purchased with real money.
Once you own a pet it follows you around and can be set to pick up loot, which is the main reason players bother. Pets are not permanent, though. They have a duration and need to be fed with pet food to keep going, and if one expires or is lost you can buy a revival item from the Cash Shop.
Pet food itself comes in two forms. Some players buy it from other players in Henesys for mesos, which is cheaper than the Cash Shop equivalent, so it is worth checking there before spending NX.