General strikes spread through the occupied West Bank and tenions in Arab towns continued to rise today, after an Israeli Supreme Court judge rejected an appeal alleging that Bassam Shaka, the militantly nationalistic Arab mayor of Nablus, had been improperly imprisioned after being served with a deportation order.

Nearly two dozen mayors of towns on the West Bank and in the Gaza Strip said they would resign Tuesday in support of Shaka, who was arrested Sunday on the grounds that, in a private conversation with an Israeli military official, he expressed approval of the Tel Aviv costal road massacre in March 1978, in which 34 persons died.

Elias Freij, the Arab mayor of Bethlehem, said all of his city's municipal employes would stop work, which would paralyze the popular tourist attraction.

Commerical strikes, which began yesterday in Nablus, spread today to the west Bank towns of Ramallah and Jenin. In Bir Zeit, striking students stoned cars on the main road through town. Small, scattered demonstrations were reported elsewhere in the occupied territories.

As tension on the West Bank and in Gaza increased over the shaka incident, the government of Prime Minister Menachem Begin suffered a setback here with the parliamentary defeat of a bill to amend the 1978 abortion law.

The amendment, which would have eliminated a liberal clause allowing abortions for social and economic reasons, was defeated by a 54-54 tie vote in the Knesset.

The ultraconservative Agudat Israel Party, a member of Begin's ruling coalition with four seats in the parliament, regards the clause as a violation of Orthodox Jewish law.

The Knesset defeat cut across party lines. One politician deserting the prime minister on the issue was former foreign minister Moshe Dayan.

A walkout by Agudat Israel, which had threatened to leave the coalition if the abortion law was not changed, would not automatically mean the collapse of the Begin government and party leaders indicated tonight they would not desert Begin.

The 29-month-old coalition would fall only if Begin proved unable to muster 61 out of 120 Knesset votes to defeat a motion of no-confidence. A shift by Agudat Israel still would leave Begin with 61 votes.

Protests over the Shaka incident, meanwhile, spread to Israel itself, as about 200 members of the Peace Loyalist Bloe, a coalition of Israeli peace groups, demonstrated in front of the Israeli Foreign Ministry against Shaka's expulsion and in support of negotiations with the Palestine Liberation Organization. Daniel Amit, a Hebrew University professor and Peace Loyalist Bloc activist, charged the government with contriving "fabricated charges of terrorism. . . aimed to deprive West Bank Palestinians of one of the most central spokesman, and to intimidate others into passive acceptance of occupation."

Despite the solidarity among the mayors and municipal council officials in support of Shaka, there appeared to be some confusion among West Bank politicians as a result of conflicting instructions from Palestine liberation movement groups outside the occupied territories.

West Bank sources said the PLO headquarters in Beirut had issued instructions to mayors not to resign, presumably because such a move would dilute organized West Bank resistance to the Camp David agreements and endanger proposed autonomy for the West Bank and Gaza.

However, the PLO's Rejectionist Front and the Rakah Party (communist) were said to be urging the mayors to resign as soon as Shaka is deported across the Allenby Bridge to Jordan.

If the mayors carry out their threats, the Israeli occupation government would appear to be faced with three options: to refuse to accept the resignations in the hope that the mayors would eventually return; to appoint Israeli civilians to head the municipal governments; or to allow the military government to take over municipal services.

When Shaka will be deported remained uncertain tonight. His attorney, Felicia Langer, presented an appeal to the High Court of Justices on the basis that the restraining order the court issued on Sunday applies to incarceration as well as expulsion. The appeal was rejected.

Shaka said he will not appeal the deportation order to a military advisory committee, as permitted under the 1945 British Mandatory Emergency Defence Regulations, under which the order was issued. Normally, expulsions are carried out immediately upon serving of the orders -- without appeal -- and since Shaka is refusing to request a hearing before the military committee, it is doubtful that he could pursue an appeal in the civil courts.

Meanwhile, Gaza Mayor Rashid Shawa is scheduled to meet Tuesday with Defense Minister Ezer Weizman in a last-ditch appeal to reverse the deporation order. Also, a delegation from Nablus is expected to meet with Weizman on Wednesday.