In terms of human evolution, cities are a relatively modern invention. Nobody is quite sure when or where the first cities started to develop, but they are generally thought to be a product of increasing reliance on agriculture that started around 5000BC Nowadays, cities have spread across the planet becoming larger and larger and, as the population continues to increase exponentially, more and more crowded.
In large cities you get lots of people all packed close together. This encourages not just bacteria (which get everywhere anyway) but particularly large and virulent epidemics which spread through the crowded conditions with frightening ease. This is helped by the living conditions that cities encourage. In small travelling communities of early humans it is only natural not to defecate where you eat, but in a city the problem is almost unavoidable. Wherever you leave waste it's likely that someone will be eating nearby. There's a reason that medieval London had a river called 'shitbrook'.
When the Black Death, caused by the bacteria Yersinia pestis, swept across Europe it killed over 1/3 of the population. This level of destruction is almost impossible to imagine today (particularly given that one third of the population of Europe today would be around 250 million people). One of the things that helped the bacteria to thrive was the conditions that the cities encouraged. Yersinia infects fleas, which travel on rats and huge populations of rats could be found in every major city in Europe. Often I suspect, they outnumbered the people. It wasn't just rats either, cities were crammed with animals including sheep, goats and pigs. Animals and humans in close proximity creates a breeding ground for zoonotic diseases, which can be highly deadly when they switch species.
Not only are cities a good way to put humans and animals in close contact, they are also notorious for ill-health and bad living conditions compared to nomadic lifestyles. Water has to be brought in and shared around between many people. Overcrowding is common, as are disease vectors such as fleas and bed-bugs that can carry bacteria between humans. With the bad conditions, the close cramped living conditions and the complete lack of understanding of germ theory it's no wonder the disease swept through Europe until pretty much everyone had either died or survived.
As well as putting humans and animals close together, and encouraging living conditions that spread disease, cities also provide the idea population for diseases to spread through. At the time of the Black Death Europe wasn't so much suffering a famine as living through a perpetual famine crisis. Hunter-gatherers move around to follow food, but in cities a population is pretty much trapped, relying on the surrounding agricultural infrastructure to survive. In times of famine people are weaker, which can dampen the immune system leaving them more susceptible to diseases.
Before the development of cities bacterial diseases would have been present (cystitis springs to mind...) but the virulent and decimating plague-bearing diseases were unlikely to have arisen, or if they did there was no way for them to spread so far. Hunter gatherer populations did face hardships but on general they ate better and more regularly, got more exercise, and drank water that they were pretty certain was not contaminated. Cities might provide protection, and a solid base for trade and economic infrastructure, but they are also a brilliant way to encourage bacteria to grow and spread disease.
If you want to read more about how cities encourage bacteria go take a look at James's post about emerging infectious diseases in cities!