Joseph E. Baird was ousted yesterday as president of Occidental Petroleum Corp. by its 81-year-old chairman, Dr. Armand Hammer.

After a board of directors meeting at corporate headquarters in Los Angeles, Hammer announced that Zoltan Merszei, 56, would replace Baird.

Merszei, the former chairman, president and chief executive officer of Dow Chemical Co., joined Occidental in April as vice chairman.

Baird's days at Occidental have been numbered since last fall when he engineered the energy company's abortive attempt to take over Mead Co., a Dayton forest products concern.

What Baird apparently didn't realize was that Ohio has stiff laws meant to protect native industries from outsiders.

Under Ohio law, Occidental was forced to open its books to Mead. And during two weeks of hearings before the Ohio Division of Securities. Oxy's flamboyant financial history was laid out.

The hearings drew attention to Occidental's subsidiary, Hooker Chemical, with serious environmental problems that will be extraordinarily costly to the company in the years ahead.

Hooker's role in the Love Canal disaster at Niagra Falls and other envirnonmental problems in Michigan and California were paraded out by Mead.

The Justice Department compounded Occidental's wooes by filing an antitrust suit to block the takeover of Mead.

The publicity continues to the present, and chemical waste problems are now under investigation by numerous state and federal authorities.

In the end, Occidental was forced to retreat from the costly takeover battle.

Baird, who is 46 years old, was hired in 1974 after Hammer, who critics say always has treated Occidental as more a proprietorship than a public corporation, had dispatched two other presidents in a brief period.

A respected banker, Baird was meant to mollify the numerous banks around the world where Occidental always has maintained huge loans.

These bankers are expected to be troubled by the departure of Baird, who the company said yesterday will be retained as a consultant. Occidental's stock closed yesterday at more than $24 a share, near the high for the year, buoyed by the company's highly publicized hopes for shale oil production.

In the first six months of 1979, Occidental rebounded from a massive write-down in the same period a year earlier.

In 1978, the company wrote off a $122 million investment in oil refineries in Britain and Belgium. As a result, the company suffered a loss of $35.9 million in the first six months of 1978, which it turned into a $200 million profit in the same period this year.