
Dental science, like other medical science, was in its infancy in the 19th century. Even so, it had been understood since ancient times that keeping one’s mouth clean would help prevent tooth decay (though not why--the idea that tooth decay is caused by bacteria was not proposed until the 1890s). Two common methods for cleaning teeth were rubbing them with a damp rag dipped in salt and ashes, or using a cleaning stick, a twig (often of some aromatic wood) chewed at one end until it was fibery and brushlike, which would then be used to clean tooth surfaces (the other end was often sharpened to a toothpick-like point to remove matter from between teeth). Of course, not everyone bothered; the situation was exacerbated by the increasing availability and dropping cost of refined sugar in the 18th century…which is why white teeth and good breath were noteworthy.

Toothpaste has a more recent history. Ancient peoples including the Egyptians, Greek, and Romans used various compounds to clean the teeth: ingredients included iris root, chalk, ground oyster shells, or pulverized charcoal. As mentioned above, a combination of salt and ashes was sometimes used as a sort of polish to rub on teeth.
The first commercially sold preparations used for cleaning the teeth were 19th century in origin. I have several advertising supplements from La Belle Assemblee containing ads for such products as “Chevalier Ruspini’s Dentrifice” (“most salutary during the winter season, the effects of cold and damp air on the Teeth and Gums being repelled and counteracted by its balsamic and astringent qualities.”) and “Trotter’s Oriental Dentrifice or Asiatic Tooth Powder” (“Patronized and used by Their Royal Highnesses the Dukes of Clarence and Kent, and Gentlemen in the Navy and Army, who have found the good effects in long voyages.”) It sounds as though toothbrushes were dipped in the powder, rather than the powder being made into a paste with added water; from what I’ve been able to find, actual toothpaste didn’t supplant tooth powders until after the first world war.