Soviet specialists inside and outside the government were taken by surprise yesterday by the sudden replacement of the Soviet Union's top career military officer, Marshal Nikolai V. Ogarkov. Several of the specialists said it may prove to be an event of major importance, even while saying they are uncertain just what it means.

The terms of the sparse announcement by the Soviet news agency Tass seemed to U.S. government specialists to mean that Ogarkov is not being promoted to defense minister, the only military-related post higher than the one he has held for nearly seven years. The language of the statement also was read here to indicate he will not become chief of Warsaw Pact military forces, the only other Soviet military post on a par with the one he is leaving.

One possibility, according to a U.S. analyst, is that Ogarkov is being relieved of his highly demanding job for health reasons and will be assigned to the Ministry of Defense's board of inspectors, a semi-retirement post given to some top Soviet officers in the past.

Official sources said there was no advance warning of the change at the top of the Soviet military, nor any sign of serious disagreement between civil and military officials. Any such falling out, for political or personal reasons, could have continuing repercussions.

Sergei F. Akhromeyev was considered the logical eventual successor to Ogarkov since being named a marshal of the Soviet Union in March 1983, officials said. Therefore there was little surprise at his appointment.

A U.S. official who met Akhromeyev in Moscow several years ago described him as "reserved" in deferring to political leaders who were also present. "When he spoke, he did so with a great deal of force and confidence," this official said.

Specialists said there were striking parallels in the careers of Ogarkov and Akhromeyev, both of whom came to prominence as staff officers rather than as field commanders. Raymond L. Garthoff of the Brookings Institution, formerly a senior Foreign Service officer, said associates of both men had described Akhromeyev as "someone Ogarkov himself brought along" to a high post and said the two men were friends.

Ogarkov had an unusual degree of personal contact with Americans because he had been a Soviet negotiator in strategic arms talks in the early 1970s and met numerous times after that with U.S. military, official and political figures. Akhromeyev's personal contacts have been fewer but, like Ogarkov, he has appeared in Moscow news conferences in the past year as a prominent spokesman for the Soviet military.