Alexander M. Haig Jr., charging that U.S. foreign policy no longer reflects "consistency, clarity and steadiness of purpose," abruptly resigned yesterday as secretary of state. President Reagan immediately chose former treasury secretary George P. Shultz to replace him.

The resignation, an embarrassment for the president at a particularly tumultuous time in foreign policy, was announced initially by Reagan in a surprise visit to the White House press room. About two hours later, Haig appeared in the auditorium of the State Department and before an audience of almost 1,000 reporters and department employes read a letter he had sent to the president. It said in part:

"We agreed that consistency, clarity and steadiness of purpose were essential to success. It was in this spirit that I undertook to serve you as secretary of state. In recent months, it has become clear to me that the foreign policy on which we embarked together was shifting from that careful course which we had laid out. Under these circumstances, I feel it necessary to request that you accept my resignation." While Haig thus said it was policy disputes that made him the first member of the Reagan Cabinet to resign, several administration sources said last night that prickly personality differences also played an important part. But in any case, the resignation came amid serious disagreements with the White House over how to deal with Israel's invasion of Lebanon.

According to the sources, the White House had become increasingly unhappy with Haig's advocacy of an accommodative line toward Israel's attempts to crush the Palestine Liberation Organization in Lebanon. Largely because of Haig's advice, Reagan publicly endorsed Israel's goals following a White House meeting with Israeli Prime Minister Menachem Begin on Monday.

However, the president, concerned by the mounting death and destruction caused by Israel's attacks on Beirut, is understood to have moved closer to the views of national security affairs adviser William P. Clark and Defense Secretary Caspar W. Weinberger. They are known to favor putting pressure on Israel to halt the fighting and pull back its forces.

In addition to finding himself increasingly isolated on the Lebanon situation, Haig recently was on the losing end of the battle over Reagan's decision to try to penalize the Soviet Union for the crackdown in Poland by denying U.S. technology to European firms supplying equipment for a natural gas pipeline from Siberia to Western Europe.

State Department sources said these were the principal issues that caused Haig to conclude he had been forced into a position where he no longer had control over foreign policy. The sudden, obviously bitter nature of his departure seemed certain to rekindle frequently heard charges about disarray in the administration's policy-making machinery.

It also raised questions about how Shultz, a veteran of Cabinet and White House posts in past Republican administrations, will fit into the pecking order of the Reagan Cabinet and what changes of direction and emphasis in administration policy he will seek.

Like Haig, Shultz has a strong orientation toward Western Europe, where he is on close terms with such leaders as West German Chancellor Helmut Schmidt, and he seems likely to echo Haig's argument that the decision on the pipeline could have serious effects on relations with America's principal Western Alliance partners.

The biggest potential differences that Shultz might seek to make are likely to involve Mideast policy. His position as chairman of the Bechtel Group Inc., which has major construction interests in Saudi Arabia, gives him a reputation as favoring the Arab side in the Middle East conflict.

Several pro-Israeli senators, noting that Weinberger also came from Bechtel, said last night that they intend to question Shultz closely during his confirmation hearings about whether his move into the secretary's post will lead to a cooler and tough line in U.S. relations with Israel.

Shultz, who was in London yesterday, told reporters there: "I think this is my moment for silence."

He was expected to arrive here today and meet with Reagan at Camp David, but administration sources said they doubted that his coming would lead to any sudden or dramatic policy departures.

However, as of last night, the major interest in official Washington was not on what might come next but on what had happened to make Haig the administration's first Cabinet-level casualty. Throughout Reagan's first year-and-a-half in office, the combative former general had been the best known and, in many respects, most controversial, figure in government.

Haig started out asserting that he intended to be "the vicar" of U.S. foreign policy, and much of his tenure was marked by well-publicized clashes with the White House and the Pentagon over turf, prerogatives and policy control. Despite his penchant for tough-sounding, Cold War rhetoric, he became known within the right-of-center administration as a relative moderate and pragmatist willing to tailor his conservatism to the realities of a given situation and to pursue policies based on consensus and compromise with U.S. allies.

He remained a loner outside the tight group of old California political cronies who formed Reagan's inner circle. Yet, for a long time, he appeared to be winning most of the battles; and it was generally accepted in diplomatic circles until recently that his was the major imprint on most administration policies.

However, as was made clear by his problems over the pipeline and the Middle East, he lately had been on an extended losing streak. Several State Department sources yesterday blamed Haig's declining influence on the rise of Clark, who had been Haig's deputy at the department before moving into the national security adviser's job at the beginning of the year.

The two had worked well together at State, and Clark is understood to have tried hard to continue a harmonious relationship after his shift to the White House. However, Clark, an old and trusted Reagan intimate, also began to side increasingly with Haig's adversaries such as Weinberger on policy issues.

"It was Clark who made the difference," one senior State Department official said last night. "Haig knew Clark was someone he couldn't beat, and he felt that policy was drifting in ways he couldn't control. He wasn't asked to resign, but he was forced out, in a sense, because he felt his position had become impossible."

The first word of Haig's departure came shortly after lunchtime when a grim-faced Reagan came into the White House press room and made his announcement. The president, who refused to answer questions, left the room quickly and departed shortly afterward for a weekend at Camp David.

Later, the White House made public a letter from Reagan to Haig, saying the president was accepting the resignation "with the most profound regret" and adding: "The nation is deeply in your debt."

Shortly afterward, Haig met privately with the senior officials of the State Department. Sources who were present said he reiterated essentially the same points about consistency that were contained in his resignation letter and expressed his concern about what he called "the drift" in U.S. policy.

The meeting broke up after Haig thanked his aides for their dedication and asked them to give the same loyalty to Shultz. Some sources said that, in the atmosphere of "surprise, upset and sadness," Haig seemed "surprisingly relaxed."

The secretary then went to the department's vast auditorium where he received a long standing ovation from the hundreds of Foreign Service officers and other employes assembled there.

After reading his letter, he praised them for their support and dedication, made a courteous bow of appreciation to the press, with whom he has frequently feuded, and then strode off the stage so quickly that reporters were able to make only the most perfunctory attempts at tossing questions after him.

In Congress, most of the initial comment reflected confusion, mixed with cautious words of praise for both Haig and Shultz. Both Senate Majority Leader Howard H. Baker Jr. (R-Tenn.) and Foreign Relations Committee Chairman Charles H. Percy (R-Ill.) predicted that Shultz will be a great secretary of state.

Sen. Charles McC. Mathias Jr. (R-Md.) said it was "really unfortunate" that Haig had resigned in the midst of the Lebanon crisis, which he said might be "deepened by this event." The choice of Shultz as Haig's successor evoked wary comments from members of Congress who advocate a strong pro-Israel position. Typifying their reaction was that of Sen. Alan Cranston (D-Calif.), who noted that Bechtel has "major business ties with Saudi Arabia, a sworn enemy of Israel."

Cranston, a member of the Foreign Relations panel, said he would question Shultz about those ties when the committee considers his nomination. That is expected to be shortly after Congress returns from its Fourth of July recess on July 12.

Other countries reacted with almost the same degree of surprise that was evident here. For example, Washington Post foreign correspondent Bradley Graham reported from Bonn that Richard R. Burt, Haig's designated assistant secretary for European affairs, paled visibly when he heard the news at a reception and immediately asked: "Do you have a phone I can use to call Washington?"

German officials attending the reception were initially disturbed at the news because they regarded Haig as the administration's leading advocate of close ties to Europe. But the word about Shultz, whose friendship with Schmidt is well known in Bonn, quickly restored spirits.