After six years of military rule, Pakistan's president, Gen. Mohammed Zia ul-Haq, announced today that he will hold elections for the National Assembly and end martial law within 18 months.

Zia, who promised to hold national elections and return Pakistan to civilian rule within three months after he seized power in a military coup on July 5, 1977--and who has made similar promises several times since--said today that he would remain as president but that his powers would be shared with a prime minister after March 1985.

In a televised address, Zia said the 1973 constitution, suspended since he seized power, would be restored, but with amendments that will strengthen the power of the president, giving him the right to dismiss the prime minister and dissolve the largely consultative National Assembly.

Zia did not say when the constitutional amendments will be made or by what process he plans to stay in power. But he said martial law will remain in effect until after provincial and national elections, and that persons attempting to disrupt political stability will be dealt with severely.

Zia's announcement appeared to be timed to preempt a national campaign of civil disobedience planned by the eight-party Movement for Restoration of Democracy to begin on Sunday, the 37th anniversary of Pakistan's independence.

Apparently anticipating antigovernment demonstrations, security forces yesterday began rounding up opposition leaders in Lahore, Karachi and in Northwest Frontier Province. Zia had not been expected to announce his reforms until Sunday.

Zia, who is also Army chief of staff and chief martial-law administrator, pledged that Pakistan never again would have to worry about the excesses of an elected leader. Zia came to power by overthrowing Prime Minister Zulfiqar Ali Bhutto, who later was hanged for the murder of a political foe.

Speaking before the nominated consultative National Assembly, which usually rubber-stamps his programs, Zia said elections will be held in two stages, with municipal balloting to be completed by the end of the year, followed by provincial, regional and National Assembly elections.

The elections will be held on a non-party basis, however, and candidates will not be allowed to conduct individual campaigns because such campaigns are "contrary to Islamic principles," Zia said, according to a translation of his Urdu-language speech that reached here tonight.

He said religious minorities will elect their own candidates, adding that they are the "most privileged class under Islam." Political parties have been banned since Zia seized power.

Repeatedly, Zia stressed the need to return Pakistan to fundamental Islamic principles, which, he said, "still hold good today." He said the changes he envisages will allow him to continue to transform Pakistan into an Islamic state.

Zia said there would be "no new role for the armed forces," although he did not specify what role the military will play. He repeatedly has said that the Army must serve in the government to instill discipline and prevent a breakdown of order that has occurred in previous partisan systems.

His announcement appeared to satisfy some--but not all--of the requirements spelled out last month by a consultative committee of the National Assembly that had been entrusted with the task of recommending a political structure that accords with Islamic values.

The committee recommended a return to the 1973 constitution, with powers split between a president and prime minister, but said that political parties should have a role. Assembly speakers during a week-long debate were unanimous in opposing martial law and a majority of them said they favored a British-style parliamentary democracy.