Their primary job was to run alongside the carriage and protect it from other animals, especially other dogs.
They were also used to guard the horses while the carriage was stopped.
Interestingly, the Dalmatian's spotted coat was likely a result of natural selection, as the spots helped them camouflage themselves in the dust and dirt of the roads they ran on.