With the recent Covid-19 situation and everything, organizations have realized that remote jobs are indeed a viable option. So, hypothetically the organization could say let's just outsource everything that can be done remotely to a country where this can be done for cheap. So, is there anything that prevents them from doing so?
International trade agreements make it hard to ban outsourcing outright. As a result, most bans are narrow, aimed at products where outsourcing could compromise national security. However, there are plenty of laws that countries can use to discourage outsourcing. These laws vary enough that the answer to your question depends on where you live, what you make, and where you want to outsource to.
The most direct way to discourage outsourcing is by using tariffs, taxes on imports, and/or subsidies to local producers. By taxing imports, tariffs raise the price of outsourced goods, offsetting the advantage of lower cost of production overseas. By helping domestic producers, subsidies such as tax-breaks offset the disadvantage of higher domestic costs. Tariffs and subsidies are often narrowly tailored to protect and promote specific industries, such as sugar producers in Louisiana.
Various regulatory laws, including those requiring licensing and inspection, can be used to indirectly favor local producers by raising costs to overseas producers.
Local content laws limit outsourcing by requiring a certain percentage of the content of any product be locally produced. Canada is notorious for using local content laws, most (in)famously in requiring local content in entertainment, including radio and tv broadcasts.
A recent example of how different laws work together to discourage outsourcing and promote local productions involves renewable energy producers. To encourage investment in renewable energy, many governments offered tax breaks or other subsidies to investors. Often, these subsidies were only available to products that met local content laws. (Not surprisingly, Canada had a myriad of such requirements.)
In fact, it’s done routinely.
As an Australian I am aware of many Australian companies with China based manufacturing, Philippines based call centres, India based software developers and Thai based construction engineers (not necessarily the same company).
There are certain industries with legal impediments like security for defence industries and privacy for health businesses.