I don't know about the Medieval period, but reading a book about Galileo, I noted that his communications with the officials in Rome was hampered by the fact that the cities along the mail route would close their gates and impose a quarantine whenever a plague went through the region. So at least they had a hunch that the disease could be carried from A to B, even if they didn't know by what.