To protect its local industries and jobs. Placing trade barriers restricts cheaper goods and service that may out-compete those of the local market if allowed to freely compete in the local market.
To protect its population when it feels that the foreign products or services do not meet its national standards and that the goods/services may be harmful for its local population as a measure of national security.
Trade barrier and tariffs are also used as a form of diplomacy. Trade barriers are imposed on good and services from a country that a nation considers hostile.