In the first half of 2020, several countries have responded to the challenges posed by the Covid-19 pandemic by restricting their export of medical supplies. Such measures are meant to increase the domestic availability of critical goods, and are commonly used in times of crisis. Yet, not much is known about their impact, especially on countries imposing them. Here we show that export bans are, by and large, counterproductive. Using a model of shock diffusion through the network of international trade, we simulate the impact of restrictions under different scenarios. We observe that while they would be beneficial to a country implementing them in isolation, their generalized use makes most countries worse off relative to a no-ban scenario. As a corollary, we estimate that prices increase in many countries imposing the restrictions. We also find that the cost of restraining from export bans is small, even when others continue to implement them. Finally, we document a change in countries' position within the international trade network, suggesting that export bans have geopolitical implications.