Tomatoes can in fact self-pollinate. These plants have both male and female flowers, meaning they are able to self-fertilize. There are some types of tomatoes which are able to self-pollinate more easily than others, though many people have cultivated self-pollinating varieties for many years and continue to do so today.
Those who are planning on growing heirlooms will want to consider getting another plant just to make sure. Keep in mind that the two tomato plants do not have to be of the exact same variety, as they tend to taste the same no matter what is responsible for pollinating them.