Syria announced yesterday that President Hafez Assad is to visit Iraq this week, a startling turnabout in Arab affairs that could give new credbility to Arab opponents of the Camp David agreements between Egypt and Israel.

Syria and Iraq, ruled by rival wings of the Arab Baath Socialist Party, have been locked in a biutter ideological feun for years. Their quarrel has been a major obstacle to forming a cohesive front of Arab countries that oppose the Campe David accords.

A rapprohement between them could alter the balance of power in the Arab would and give added weight to the anti-Camp David nations. Syria reconciled with Iraw would become a more potent fore in Arab affairs, and a more persuasive claimant to the key support of Saudi Arabia.

The dispute between Damascus and Baghdad runs deep, however, and a number of previous attempts at reconciliation by Saudi and other mediators have stumbled on the enmity built up over the years. There was no way to fell immediately whether Assad's visit signals lasting change.

But whatever its long-term effect, the official announcement from Damascus that Assad would make his first trip to Baghdad since 1973 and that the two countries woudl "face together" the challenge of Camp David is likely to come as a rude shock to Egypt. The announcement gave no further indication of what the visit intended.

The Egyptians, in assessing the troublemaking potential of their opponents in the Arab world,have been taking it for granted that the Syria-Iraq feud would continue to make it impossible for those two counties to act in concert. That looked like a safet test last month when Iraq refused to participate in a Damascus summit conference of Arab leaders most opposed to Sadat's peace initiative.

The Iraquis' absence was not a surprise. They are perhaps the most absolutist and uncompromising of all the Arabs in their views about Israel and they had been feuding not only with Syria but also with the Palestine Liberation Organization, whose leadership the Irawis regard as insufficently militant.

Since that meeting, however, several things have happened. Assad visited the Soviet Union, the major political and military back of both Syria and Iraq. The Iraquis, edge to show their sincerity in opposing the Camp David framework, offered to send troops to fight alongside Syria on the Golan Heights. The offer was widely regarded as an Iraqi play to embarrass Assad, but may have been more than that.

Iraq also called for an Arab summit conference to be held in Baghdad Nov. 2, and received suprisingly favorable response from "many Arab states, including Syria.

The Baghad government in fact, appears to have embarked on a largescale campaign to organize and lead, Arab opposition to the policies of Egyptian President Anwar Sadat. This could turnabout to be a source of more friction: It is difficult to imagine Assad accepting any such Iraqi leadership.

Iraq's official news agency announced yesterday that Foreign Minister Saadoun Hammadi had flown to Saudi Arabia carrying a message to Crown Prince Fahd from Saddam Hussein, Iraq's political leader. The message, the announcement said, dealth with preparations for the Nov. 2 summit and with the Arab foreign ministers' conference scheduled to be held in Baghdad three days before that.

Saudi Arabia's role remained a major uncertainty in the presummit developments. The Saudi leaders earlier were reported making their attendance at the Baghdad summit conditional on Iraq's issuing an invitation to Sadat. But there has been no work this has happened, and no indication that it is likely to.

The Saudi attitude is particularly important because Assad, King Hussein of Jordan and the PLO depend heavily on petrodollar largesse from the Saudi royal family. It was unclear where Assad will find a balance between this dependence on Saudi money and an equally vital dependence on the Soviet Union for military supplies.

Iraqi officials were taling last week of redeploying forces to join Jordan, Syria and the Palestinians in preparing for military confrontation with Israel, and of setting up a joint Arab fund that would give economic aid to Egypt if it would repudiate the Camp David agreements.

None of those moves would have amounted to much, however, and the Nov. 2 summit would not have been expected to produce any coordinated strategy, without reconciliation between Iraq and Syria.

It happens often in the Arab world that countries hostile to each other are suddenly reconciled, or that countries that are allies one day are foes the next. But the split between Syria and Iraq, in which the two countries took every step they could against each other short of armed conflict, seemed so deep as to be irreconcilable.

The Iraqis have called openly for Assad's downfall. Syria has blamed the Iraqis for a series of assassinations and terrorist bombings inside Syria. Air communications between the two countries were suspended and the land border was closed.

Iraq went so far as to build a new oil pipeline to Turkey, enabling the Iraqis to shut off the flow of their oil to Syria and stop making payments for use of a pipeline to Syrian ports.

The roots of this dispute involve Baath Party politics, historically rival claims to leadership of the Arabs, economic issues and a struggle for influence over the PLO. The Iraqis also were infuriated by construction of a dam on the Euphrates River in Syria, which they said cut off the water supply to thousands of farm downriver in Iraq.

Syria's policy is to seek a negotiated peace with Israel on the basis of U.N. Security Council Resolution 242. Under Syrian tutelage, the PLO has more or less come around to the same position, without officially saying so. Syrian opposition to the Camp David agreements, like it earlier opposition to the Sinai disengagement agreements and Sadat's trip to Jerusalem, is based more on disapproval of Sadat and his methods than on fundamental strategy.

One reason for the ineffectiveness of the so-called Steadfastness Front of Sadat's opponents, which Syria organized after the Jerusalem trip, is that Assad wants peace with Israel and wants the PLO to take what it can get in negotiations. The other, more distant members - Algeria, Libya and South Yemen - reject the existence of Israel altogether.

That also is the position of Iraq, if the Iraqis are seriously prepared to build up an armed confrontation with Israel, that represents a fundatmental difference with Syrian policy.