You can usually find a stable master NPC around an inn or innkeeper NPC. To stable a pet, right-click on the stable master to open the stable window. You will see your current pet displayed as an icon on the left side of the window. On the right side are four slots. Depending on if you purchase to open the slots, they will be either active, or red to show you still need to unlock them.