The execution of former prime minister Zulfiqar Ali Bhutto has shaken Pakistan's armed forces, raising the prospect of military action against Gen. Zia ul-Haq's government and a civil war.

Zia, who seized power from Bhutto in a military coup two years ago, has put the armed forces under consideratable strain. There was an agonizing debate within the officers corps over the wisdom of executing Bhutto.

Now, there is a growing feeling among senior officers that the military may have lost its way in a political minefield and that the advantages gained by Zia's coup have been thrown aside.

If the generals indulge in politics, they cannot be surprised to find that majors, captains, lieutenants, squadron leaders-and on down to the ordinary soldiers-have also become politicized. After all, the country is being run in their name.

The hanging of Bhutto, after keeping him in degrading conditions, has turned a large section of Pakistanis against the security forces. Women now taunt policemen and soliders in the streets, questioning their manhood and their courage. For those in uniform who disagreed with the political decision to kill the deposed prime minister-and who would have voted for him in an election-this is particularly galling. Increasingly, Zia's actions are being questioned in private.

The military ruler has one trump card. His officers are fiercely loyal to Pakistan, and many fear that any intervention by them would split the armed forces and destroy one of the last surviving institutions. The end result could be a civil war and the breakup of the country.

For the moment, at least, his political opponents within the military are gritting their teeth while Zia pursues his vision of a new Pakistan, and disturbances spread through the country.

The military takeover 21 months ago had a limited objective. It came at a time when Bhutto's Pakistan People's Party was losing popularity. The prime minister was arrogant and bullying. Many of his henchmen were considered sychophants. Political opponents were arrested without trial and tortured. Some simply disappeared.

The small opposition parties banded together to form the Pakistan National Alliance and confronted the People's Party at general elections. Bhutto's party squeezed home, amid angry charges of election rigging, and there were street riots that left scores dead.

The military moved in and seized control. Zia became chief material law administrator with the objective of restoring law and order and holding new elections within six months. After that, he promised, the Army would return to barracks.

Between the coup and Zia's subsequent announcement that it would not, after all, be possible to have elections so soon, a change came over him.

He formulated a plan to alter the structure of Pakistani life so fundamentally that when civilians were allowed to resume conrol, it would be very difficult for them to change course.

There was a political and a religious element to his plan. On the political front, Zia calculated that the thing most wrong with Pakistan was the presence of the Bhutto "dynasty." The People's Party had become virtually an unchallenged Bhutto preserve. If Bhutto was disposed of, the torch would go from him to his second wife, the Begum Nusrat, and from her to their daughter Benazir, 25.

Other members of the family, living outside Pakistan, presented less of an immediate political threat.

Iwth Bhutto gone, his neck snapped by a hangman's rope, Zia's attention has now turned to Bhutto's political successors: The Begum Nusrat and Benazir. Both women are under house arrest near a police camp. The Begum has already been banned from taking part in politics, pending a decision by a military disqualification tribunal.

The next step is expected to be criminal charges against the Bhutto women, perhaps even a case of high treason.

Those close to the military ruler say he wants to cleanse the People's Party of the Bhutto influence, because he realizes that public opinion has once again swung strongly in its direction and that the party will probably be swept back to power when the nation goes to vote.

The religious element in Zia's vision for Pakistan is to turn the country into a fundamentalist Islamic state, and try to ensure that the new structure will be difficult to dismantle by a subsequent civilian administration.

Already the Islamic penal code has been partly adopted with the penalty for a proved adultery being stoning to death. Amputations of hands and feet have been laid down for robbers, and public flogging and imprisonments prescribed for a host of other offenses, from drinking alcohol to prostitution. Further sections of the Islamic penal code will be introduced soon.

Had Bhutto been tried under the Islamic code, he would have almost certainly been acquitted since it does not provide for death penalty for conspiracy to murder, the charge leveled against Bhutto. Zia is believed to have hung on to the English common law inherited from the colonial days until Bhutto was removed.

Another aspect to Islam which is being introduced involves two new religious taxes, zakat and ushr, under which Moslems give to the poor a proportion of their income-2.5 percent-as well as up to 10 percent of their produce if they are farmers.

It is too early yet to say what changes this will make to the lives of millions but much of this system of payment is voluntary. People can distribute their religious taxes themselves, among the poor of their own choosing. There is no way of actually checking that it has been done.

Zia, with his military manner, belives most Pakistanis will ne cheat. To him, things are very simple. The complexities and dangers appear to elude him.

The question of Islamic punishments, for example, is a contentious matter, even among devout Moslems. Zia believes the divisions among various Moslems group are not important.

Pakistan is a land rife with divisions and tensions, and the Bhutto case has exacerbate them.

Even the enemies of Bhutto are likely to use the unrest caused by his execution to advance their own regional cause.

The elections, which Zia has now promised for November 17, are not being anticipated with much enthusiasm. The small parties that formed the Pakistan National Alliance, united in their opposition to Bhutto, have begun to split away. None looks sufficiently substantial to form a government by itself.

The alliance is, at the moment, the only functioning political force in Pakistan. It agreed last year to cooperate with Zia by nominating representatives to a Cabinet made up of politicans and civil servants. The most influential of the partners is the right-wing Jamaat Islami party, a fundamentalist Moslem group, which has the ear of the military ruler and gives him considerable personal support.

Yet none of the partners in the Alliance, nor the small parties that have split away from it, speaks for the orinary Pakistani. It was Bhutto's People's Party that had the support of the common man, while the others tended to represent the small middle class, and even smaller group of rich Pakistanis.

The November elections will lay bare the comparative strengths of the parties. At this stage, it looks like a walkover for the ghost of Zulfiqar Ali Bhutto. CAPTION: Picture, Plainclothesmen subdue a man in Karachi during antigovernment protests over Bhutto's execution. AP