When an infected flea bit a person, they got infected with the plague. Some forms of the plague were spread through the air, others were spread from bites. If you breathed in infected air, then you would catch the virus. People didn't have enough knowledge about the plague to know that the rats carried it.