Pandemics are enabled by random genetic mutation and opportunities for infection. People like to be close and travel. Viruses like new hosts nearby. People are yummy. COVID is hungry.
Punishment implies "suffering from past deeds". There really isn't a "Punisher" passing judgement over us in Buddhism. In Buddhism the consequences of a deed relate to intention. The intention itself generates suffering. If one intends to walk while looking at a phone, one may soon encounter suffering. Suffering arises from unskillful deeds. In Buddhism, ethics are a guide for skillful qualities. Ethics lead us away from unskillful qualities bound to greed, hate and delusion.
So another way to rephrase your question might be, "What unskillful qualities would create pandemic suffering?" The Buddha doesn't mention anything about travel or closeness in the forty-four ethical considerations of MN8. However, we do see that:
Denying the existence of the virus falls under:
MN8:12.41: ‘Others will be uneducated, but here we will be well educated.’
MN8:12.9: ‘Others will talk nonsense, but here we will not talk nonsense.’
MN8:12.45: ‘Others will be attached to their own views, holding them tight, and refusing to let go, but here we will not be attached to our own views, not holding them tight, but will let them go easily.’
And that going to crowded places such as bars falls under:
MN8:12.37: ‘Others will be negligent, but here we will be diligent.’
MN8:12.40: ‘Others will be imprudent, but here we will be prudent.’
And that coughing on others without a mask for COVID falls under:
MN8:12.39: ‘Others will be conscienceless, but here we will have a sense of conscience.’
MN8:12.43: ‘Others will be unmindful, but here we will be mindful.’
MN8:12.44: ‘Others will be witless, but here we will be accomplished in wisdom.’
Disease affects all beings. Indeed, bananas are also being threatened by their own virus. Are bananas being punished for their deeds? I find it hard to think that way. It makes little sense to me. So it would be odd to think of the pandemic as the punishment for "past evil deeds".
But the difference between people and bananas is that people can choose to be ethical. And in that skillful choice, suffering will decrease.