NATO commander Gen. Bernard W. Rogers today said the West should take the Soviet intervention in Afghanistan as a warning, and improve its defenses and its readiness to go to war.

Saying Soviet intentions in Afghanistan and the Middle East are not fully known and the conflict may yet spread beyond Afghanistan's borders, Rogers hinted of Western military action to counter the Soviets.

For the moment, however, Rogers ruled out any NATO military response, but called on Alliance members not to slacken current costly efforts to strengthen NATO forces. Rogers also urged America's European allies to support U.S. sanctions against the Soviet Union, and to take firm actions of their own in response to the invasion of Afghanistan.

Rogers' remarks came during an hour-long session with reporters, the second-press conference the U.S. general has held since assuming command last July.

His call for European solidarity took place against a backdrop of intensive behind-the-scenes talks among the United States and its 14 NATO partners on arranging some sort of coordinated response to the Soviet action.

U.S. representatives have sought assurances from allied countries that they at least will not undercut America's initiatives. NATO sources say the United States has also made clear its interest in a firm and resolved European response.

Rogers underlined this point today, saying the United States "is watching very closely" how the Alliance members respond.

At the same time, Rogers said, "each nation has to decide in the light of its own national interest, as well as the international interest, what they believe best today."

Rogers said NATO should continue military efforts that began in 1977, to enhance readiness of alliance troops and build up defense abilities. "We must keep our powder dry," Rogers said.

He said he did not see any immediate need to expand "the NATO area," but urged that present members honor their commitments to long-term NATO modernization plans.

Rogers said no special measures have been taken, by either U.S. or other NATO forces in central Europe, as a result of the Soviet action.

He said he believes Soviet forces have already accomplished at least some of their objectives in Afghanistan -- namely, to subdue the insurgent movement, secure a communication network and establish a government subservient to the Soviet Union.

Estimating that the Soviets now have more than 60,000 troops in Afghanistan and another 30,000 on the Soviet border ready to follow, Rogers said the fighting could go on for some time. He said the insurgents were giving Soviet troops "a hard time" and there has been evidence of a number of desertions from regular forces to the insurgents.

Rogers refused to speculate on whether the Soviets might be planning to move into Iran or Pakistan to secure warm-water ports, but he acknowledged this as a definite possibility.

"We don't know what is going to happen,"" he said. "We do not know what Soviet intentions are."

What if the Soviet should be beyond Afghanistan? "The time comes," replied Rogers, "when one no longer can condone bald, open and flagrant aggressions."

Rogers said, "the Afghanistan invasion has certainly brought to the attention of all of us that, irrespective of detents . . . if the Soviet Union has made a decision to invade a country for whatever purposes, then she is going to do that."