With the more artfully carved and crafted tobacco pipes, the truly valuable portion of the pipe is the artisan-made bowl. The stem, on the other hand, is made to be replaceable and often less expensive and manufactured in bulk. Since pipe bowls are made to less-than-standard sizes and shapes, replacing the stem of your pipe requires not only careful shopping, but some hand shaping.
Measure the stem hole in the pipe's bowl. Use both the metric and standard rulers and measure the diameter of the hole so your measurements will be usable for whatever stem maker you end up shopping with. Rotate the ruler around different points on the hole's circumference to see if the shape is irregular. If so, take the average of several different diameters.
Purchase a pipe stem that's as close to the size needed for the bowl as possible. Shop at a brick-and-mortar pipe store (the bigger, the better, as smaller pipe stores often have few or no replacement stems) or at an online retailer. Purchase a pipe whose tenon (the part of the stem that is opposite the mouthpiece that fits into the bowl) has a diameter measurement as close as possible to the size of your bowl's hole. If you have to choose between a tenon that's slightly large and one that's a little small, choose based on the materials your pipe and bowl are made of; one of these will have to be sanded to fit, which is easy with plastic and wood but not as viable with stone or anything intricate and expensive that you don't want to alter.
Sand the tenon of the stem and/or the hole in the bowl to fit the pipe and stem together. Tear tiny pieces of sandpaper to wrap around the tenon or curl into a cylinder and stick into the bowl's hole. If the bowl hole or tenon are irregularly shaped, spend more time sanding the areas that stick in or out and are keeping the tenon from sliding into place.
Use waxed string to make the tenon wider, if necessary. Wrap the string tightly around the tenon in coils, as if you were wrapping string on a spool. Create one layer of string and try inserting the tenon. Trim the string if it fits; if not, remove the tenon and wrap a second layer.
While online retailers have better selections, shopping in person will give you the chance to bring your bowl along and handle new stems, so try to check out these options first.