Caught in the no-win position of violating American law or violating Canadian law, Wal-Mart Stores' Canadian unit said today that it had decided to resume sales of pajamas made in Cuba, in direct defiance of American laws that seek to isolate the Government of Fidel Castro.

Within hours, however, Wal-Mart , the Arkansas-based retailer, said that its Canadian subsidiary had deliberately defied instructions from headquarters to obey American law and cease all trade in Cuban goods. And the Treasury Department, which is charged with enforcing the American embargo against Cuba, said that it was ''reviewing'' Wal-Mart's action and declared that ''we will enforce the embargo.''

The question of how to handle the sale of the $8, Cuban-made pajamas -- available only at Wal-Marts in Canada -- has escalated in the last week into a test of wills between the authorities in Ottawa and Washington, with each seeking to enforce conflicting laws regarding Cuba. The wranging over pajamas has become particularly heated because it comes as Europe, Canada and Mexico are challenging the legality of the Helms-Burton Act, which seeks to force other nations to join America's effort to isolate the Cuban regime.

Washington has insisted that it will not allow that challenge to come before the World Trade Organization, contending the embargo against the Castro Government is a question of national security, not trade.