Marc Rich & Co., A.G., the Swiss commodities firm that had been paying a $50,000-a-day fine rather than turning over documents subpoenaed by a New York grand jury, agreed to produce the materials by Aug. 19, federal prosecutors announced yesterday.

The firm will continue to pay the fine until it produces the documents. If it does not produce them by Aug. 19, the firm will have to pay $2.6 million to federal district court in Manhattan. It already has paid $1.35 million and yesterday deposited another $1.25 million with the court, prosecutors said.

Rich has been the target of a federal grand jury probe for more than a year. The grand jury is examining whether the Swiss firm's former New York subsidiary sold oil to the parent at a loss in order to evade U.S. taxes.

The Rich subsidiary, Marc Rich International Ltd., long ago agreed to turn over documents relating to its side of the sale, but the Swiss parent resisted, citing a Swiss law that forbids Swiss companies from revealing business secrets to foreign governments.

Last fall Rich appealed a ruling by Judge Leonard Sand that it had to produce the documents, but a federal appeals court upheld Sand in May. After the Supreme Court refused a further appeal and Rich still refused to produce the documents, Sand imposed the $50,000-a-day fine for contempt of court June 29.

Sand also issued notices to 30 companies Rich does business with and ordered those firms to freeze any Rich assets in their possession. The companies included Chase Manhattan Bank, several major oil companies, and the parent company of Twentieth Century-Fox Film Corp., which is half-owned by a Rich affiliate.

Sources said that the Swiss firm finally capitulated to the court because the attachments and the publicity from the case were impairing its ability to do business.

The international commodities trading firm, which has annual revenue in excess of $10 billion, was founded nine years ago by Marc Rich after he left another major commodities firm, Philipp Brothers (now part of Phibro/Salomon Brothers Inc.). Rich, who directed the trading empire from New York, reportedly moved to Switzerland in June.

Rich, as well as his associate, Pincus Green, is supposed to sign the agreement worked out late Friday with prosecutors, but as of yesterday only Rich's attorney had signed the agreement.