Trade barriers provide protection to domestic industries.
A recession refers to a period of reduced trade and industrial activity in a country. Certain measures like fiscal policy, monetary policy, reduction in trade deficit, etc can help a country to come out of recession. However, when the country can neither depreciate the exchange rate nor use monetary or fiscal policy to control recession, it resorts to protectionism. During the time of economic downturn, the economies of all countries shrink. Therefore they try to protect themselves by imposing trade barriers like tariffs on imports so that those industries can gradually develop during the time of downturn and can flourish later in future when situations normalize.
A country can deal with recession using certain policies such as fiscal policy, monetary policy, reducing trade deficit. If the country cannot depreciate the exchange rate and if the other measures to deal with recession are also not applicable, it resorts to protectionism. Some countries implement increased trade barriers during economic downturns because they want to protect their shrinking industries during the time of downturn, as the economic position of countries is not good at that time.