Ford Motor Co., which has been under pressure from anti-apartheid advocates to pull out of South Africa, yesterday announced an agreement in principle to merge its auto plants there with Anglo American Corp., the huge South African-based conglomerate that was long associated with industrialist Harry F. Oppenheimer.

The agreement announced in Johannesburg calls for the creation of a new jointly owned company called the South Africa Motor Corp. (SAMCOR) in which Ford will own 40 percent of the stock and Anglo American the remaining 60 percent.

Ford's South African manufacturing operations, which consist of two auto plants in Port Elizabeth employing about 5,000 workers, will be consolidated with Amcar, the automotive division of Anglo American, over the next 18 months. Ford spokesman Allan Dreyfuss said yesterday it was "logical" to assume the merger will result in layoffs of Ford employes in South Africa because the primary reason for the move was to "rationalize" the two firms' operations in a highly competitive and fragmented auto market.

Although Ford is the second-largest producer of autos in South Africa and Amcar is the third, both companies have been suffering in a market where the entire industry lost an estimated $86 million last year, according to Ford officials. "We haven't been getting a reasonable return there," Dreyfuss said.

Ever since last fall, when Ford first disclosed it had begun negotiations with Anglo American, company officials have publicly stressed they had no intention of withdrawing from that country despite the mounting campaign to pressure Ford and other companies to do so.

Dreyfuss repeated that assertion again yesterday, stating that "there will be no appreciable difference in Ford's financial commitment to South Africa as a result of this merger." In addition, Ford officials said that SAMCOR, the new joint venture company, will adhere to the standards of the Sullivan Principles, a voluntary code of conduct that pledges companies to desegregate their facilities, pay equal wages to black and white workers for equal work and train black employes for managerial positions.

Rev. Leon Sullivan, a Philadelphia civil rights minister and author of the code, said yesterday that he had been consulted by Ford officials about the decision to pledge that SAMCOR will adhere to his principles. He said the fact that SAMCOR, a majority South African-owned company, will abide by the Sullivan Principles "could be an important factor" in helping to persuade other white South African companies to adopt the code.

Sullivan also noted that Anglo American "has been a progressive company in the South African context" and was a leader of a consortium of about 10 South African firms that had been meeting with him and working to improve the conditions of black workers.

Anglo American is believed to be the biggest of all South African businesses, controlling a diverse empire of gold, diamond and platinum mines. The company was long controlled by its chairman, Harry F. Oppenheimer, one of the world's richest men and a liberal South African critic of apartheid.

Oppenheimer retired as the chairman of Anglo American in 1982. His son, Nicholas Oppenheimer, who now serves as deputy chairman of the London-based Central Selling Organization of the De Beers Consolidated Mines Ltd., the diamond affiliate of Anglo American, is expected to be the eventual heir to the company's top post.