The Vatican official who oversees Roman Catholic religious orders capped a three-week visit to this country yesterday with a demand that 24 nuns who signed a controversial pro-choice abortion advertisement last year recant or face expulsion from their orders.

Despite a year of effort by the nuns and their superiors to smooth relations with the church hierarchy, the new statement was uncompromising.

Cardinal Jean Jerome Hamer, prefect for the Congregation for Religious and Secular Institutes, called the full-page ad on "Pluralism and Abortion" in the Oct. 7 New York Times a "scandal" in a statement released here by the National Conference of Catholic Bishops.

"Considering that the advertisement was published in a prominent national publication, it is evident that scandal was given, regardless of what anyone may have intended," he said. Therefore, he continued, "it is necessary that the signers take steps to repair the scandal by indicating their adherence to the teaching of the church," which, he said, is "clear, constant and unequivocal" that abortion is always wrong.

The advertisement maintained that "committed Catholics" could hold diverse views on the abortion issue, and called for "candid and respectful discussion" of the subject. It was published at the height of the controversy stirred by New York Cardinal John J. O'Connor's statements that Roman Catholic public officials are obligated by their faith to work for antiabortion laws.

Of the ad's 97 signers, 24 women and three men are members of religious orders and therefore subject to Vatican discipline through Hamer's office.

Last Nov. 30, Hamer directed the religious superiors of the 27 to "demand . . . a public retraction" or the signers would face "the threat of expulsion on grounds of obstinate insubordination."

The three men complied; the women did not. Religious superiors of the women have met several times, and with the aid of sympathetic canon, or church law, lawyers have sought a resolution of the problem that would satisfy all parties.

The women have contended that they signed the ad calling for open discussion of the issue in good conscience and that to recant would violate their consciences.

Hamer's statement yesterday was seen by one Roman Catholic leader, who declined to be identified, as an indication that the issue is "not going away."