Gen. Alexander Haig, supreme commander of U.S. and NATO forces in Europe, unexpectedly announced today that he will resign June 30 and retire from active military service.

The 54-year-old four-star general, one of the most forceful, respected and occasionally controversial commanders in NATO's 30-year history, has headed allied forces in Europe since Dec. 15, 1974.

Haig's increasing outspokenness on Soviet military developments and U.S. defense spending, and the timing of his announcement, undoubtedly will raise questions about whether he will run for political office and in some way challenge the Carter administration on defense issues.

Haig announced his decision at a press conference at the NATO military headquarters near Mons, Belgium, and said he was making his intention public six months in advance to foster an orderly shift to a successor, as yet unnamed.

"I've been here long ebough," Haig said later in a telephone interview. "I just think its time to go."

Haig, who played a crucial role in the final months of the Nixon administration as chief of the White House staff, declined to be drawn out about his plans. Despite widespread speculation that he may seek high political office, he said in the interview: "I have absolutely no political plans at this time." The general added, however, that he did not want to make adsolute statements about anything at this point.

Though Very few, if any, NATO officials claim to have insight into Haig's personal plans, one senior official said he thought Haig felt "it was time to go back to the states. He's only in his early 50s and probably wants to look at what other possibilities coule open up. He may have sensed something in the U.S. mood, or that of the Republican Party constituency, that we don't sense from here."

When Haig first arrived in 1974, after being appointed European commander in one of the final acts of the Ford administration, he was greeted with considerable suspicion in Europe because of his reputation as a political general. But gradually, the general won great respect throughout the the alliance in military and government circles as an energetic leader who improved NATO training and strategy and who could articulate his concerns over Soviet military developments with more intellectual force than many other military chiefs.

He was reappointed in December 1976 by President Carter for a second two-year term, and then given an additional extension. But for the past year or so, Haig reportadly has been involved in som serious differences with the White House and recently has had some run-ins with the West German defense minister.

MATO officials say they were caught flat-footed by the resignation because it was widely assumed that Haig would remain in office through 1979. Haig said in the interview that there was indeed "a helluva lot of confusion" about his term and he aoso made the announcement to help clear the air.

As Haig explained it, he told Defense Secretary Harold Brown in February that he wanted to be relieved of command and suggested some time around the summer of 1979. Instead, Haig said, the administration asked him privately to stay on another year and, measured from his initial summer suggestion, that time is approaching.

But in October, Brown announced that Haig would continue in his post beyond his second tour that expired in December 1978. Though Brown did not say how long Haig would serve, Pentagon officials were putting out the word it would be for another year or maybe two.

The general maintains that President Carter "has known since February what our arrangement was" but apparently a number of senior NATO and U.S. military officials were unsure.

Haig had apparently serious defference with the Carter administration early last year when he reportedly threatened to resign over White House policies on a number of defense issues including the decision to delay production of neutron weapons and alleged lack of consultation with the general on various matters. Haig has denied he threatened to resign.

When asked today about his reasons for resigning now, he said he had "concluded this for a host of reasons a year ago and nothing has changed since then."

In the past year or so, Haig has appeared to go to the public with even greater frequency and urgency with his concerns over the Soviets, especially with their reported buildup of intermediate-range missiles aimed at Western Europe. He was a strong supporter of the neutron weapon and talked last fall about "blatant, illegal Soviet intervention in the Third World."

Here in Bonn in September, Haig told a West Germanaudience he saw "no evidence, not one iota," that the Soviets were exercising restraint in their arms buildup. At the time, it struck some U.S. diplomats as something of a challenge to Carter, who had called for Soviet restraint as a measure in deciding whether to produce the neutron weapons.

In December in Brussele he said, "It would be tragic" for the NATO alliance if the United States or other allies break promises to increase defense spending. This came as Carter was wrestling with a decision whether to back down on his promise to increase defense spending.

Asked today if he was unhappy with the trend of political or military affairs within the alliance, Haig said he was not going to be quoted on value judgements of any kind along those lines.

"I haven't been a shrinking violet," he said. "But I will not, while in uniform, indulge in anything that will complicate anybody's future, including my own."