Prime Minister Shahpour Bakhtiar, in a surprise announcement, said tonight that he will fly to Paris within 48 hours to meet with Ayatollah Ruhollah Khomeini, whose millions of followers here have domonstrated for Bakhtiar's and the shah's ouster.

Khomeini's chief adviser said later in Paris that the exiled religious leader would meet with Bakhtiar. Until today, Khomeini, who considers the Bakhtiar government illegal, had insisted that the prime minister or any other official resign before any meeting could take place.

Khomeini's apparent willingness to see Bakhtiar as prime minister was seen here as an important breakthrough for Bakhtiar, who said in his broadcast announcement that he planned to discuss "Iran's future" with Khomeini.

Bakhtiar's decision to go to Paris to meet with the most powerful opponent of the remaining elements of the shah's rule comes after days of mounting pressure and demonstrations by Khomeini's followers -- 32 million Shiite Moslems who make up 90 percent of the country's population.

In demonstrations by hundreds of thousands of Khomeini supporters yesterday, troops opened fire and killed at least 30 persons.

Pro-Khomeini demonstrations today in Tehran were peaceful, but violence marred marches in Gorgan, a Caspian Sea resort, and Sanandaj, a Kurdish center in western Iran. Uncomfirmed reports said 11 persons were killed by troops in those cities.

Meanwhile, the mother-in-law and four children of Shah Mohammad Reza Pahlavi, who were thought to be awaiting the shah's arrival in the United States, flew to Marrakesh, Morocco, to join the shah and his wife. The shah left Iran on Jan. 16 on what has been described as a vacation, but is thought by many to be an indefinite exile.

The arrival there of the five, who include Crown Prince Reza, 18, was seen by some observers as an indication that the royal family will stay in Morocco for some time.

The surprise announcement by Bakhtiar came only hours after his military-backed government indefinitely extended closure of all Iran's airports to block Khomeini's efforts to return. The closure came despite warnings from hundreds of thousands of demonstrators here that further delays in Khomeini's return meant imminent armed insurrection.

Little more than an hour after announcing the continued closure, the prime minister announced his planned trip, apparently as the result of a change of heart in Paris, observers here said.

But informed sources also reported that military personnel from a major helicopter base were defying military discipline by the thousands in the provincial city of Isfahan to support Khomeini, confronting commanders with an impending split in the armed forces as well as a threat of civil war.

The armed forces are the last remaining vestige of functioning authority in Iran. The military and the religious leadership -- both conservative -- have a common interest in avoiding civil war that would benefit their joint adversary -- the nascent left.

A possible further spur for government moderation was an unconfirmed opposition report that 189 air force personnel were executed this morning for disobeying orders and demonstrating in favor of Khomeini.

While there was no confirmation, Hossein Amir-Sadeghi, a staunch monarchist and unofficial spokesman for the shah, acknowledged that problems existed in the air force. He told reporters that he "suspected" that as many as 150 air force men had been executed.

All armed forces personnel had many as 150 air force men had been been warned several months ago that disobedience was a capital offense, he said.

Symptomatic of growing exasperation with government tactics delaying Khomeini's return after 14 years in exile were the menacingly militant slogans the Tehran demonstrators chanted during a march ostensibly marking the annoversary of the death of the prophet Mohammed.

They included: "If Khomeini doesn't come, we will fight;" "If Khomeini and the clergy declare a jihad [holy war] we are ready to kill and be killed;" and "If Khomeini is delayed, the machine guns come out."

Although Moslem leaders have warned for months of an armed struggle and holy war if they did not get their way, this was the first time such militant language surfaced in the tightly monitored slogans used in mass marches.

The escalation of rhetoric indicated that the mainstream Moslem clergy had moved away from recent moderate tones to embrace the radical armed struggle ideology once the preserve of extremist Marzists and ultrareligious guerrillas.

Today's march, in bright, crisp winter weather, was noticeably smaller than earlier demonstrations in December and last week. Some participants contended that Iranians were fed up with marching and now were ready to fight.

Emotions were particularly tense as the marchers passed in front of Tehran University, where yesterday army troops shot and killed about 30 demonstrators defying a renewed martial law ban on public assembly of more than three persons.

Troops were kept out of sight along the line of march today because of an agreement worked out between opposition leaders and martial law officials.

Anger at yesterday's killings was a great factor in setting the militant tone of today's march.

Bakhtiar, on television, sought to assuage the public.

"I cannot be certain that in every corner of the country all soldiers obey all my orders," he said. "But I have instructed the army to try its hardest to make certain that no deaths occur."

"I hope that these are the last killings in the country," he added, "but if the army is attacked it is its duty to fire back."