Even in an era of frequent violence directed against public figures, the shooting yesterday of Pope John Paul II evoked a deep sense of shock across the country that was summed up by the reaction of a 27-year-old computer keypunch operator in Albuquerque, N.M.

"Who'd want to kill the pope, you know?" asked Raymond Gonzales.

Throughout the United States, which just six weeks ago was jolted by the attempted assassination of President Reagan, people of all faiths offered prayers for the pope's recovery and expressed outrage and bewilderment over the attack.

The president, who is still recovering from the gunshot wound he suffered March 30, learned of the attack from presidential counselor Edwin Meese III at 11:36 a.m. yesterday, according to White House deputy press secretary Larry Speakes.

Reagan expressed shock and then said, "I'll pray for him," Speakes said. The spokesman added that the president then called Cardinal Terence Cooke of New York and "expressed the sorrow of the American people and his personal concern" for the pope.

Vice president Bush noted that after Reagan was shot, some critics ascribed it to a peculiar American kind of violence. But, Bush added, such attacks are the result of "a worldwide sickness. We have got to find something to do about it."

Other political leaders had similar reactions. The Senate interrupted its normal deliberations as its members rose to voice anger and disbelief over the shooting. "I am sure every member of the Senate joins with me in expressing our outrage over that event and offering our hopes and prayers for the pope's recovery," Majority Leader Howard H. Baker Jr. (R-Tenn.) said.

An aide said that Sen. Edward M. Kennedy (D-Mass.), one of the country's most prominent Roman Catholic political figures, went immediately to mass after hearing of the shooting. Later, Kennedy appeared on the Senate floor and said:

"This is a shot that has gone to the soul of the world. The greatest symbol of peace in the world has been struck down by this latest act of mindless violence. Those of us who had the privilege of meeting the holy father know him as a warm and caring person. His aura has moved the earth."

The Senate yesterday afternoon unanimously adopted a resolution, sponsored by Kennedy and Sen. Pete Domenici (R-N.M.) paying tribute to the pope as "a true messenger of the Gospel and of human justice."

The attack on the pope was particularly disturbing to his Roman Catholic spiritual followers who expressed their feelings in a variety of ways.

Cardinal Humberto S. Medeiros, the archbishop of Boston, said his immediate reaction was "a mixture of shock, sickness and sadness."

"Then I asked, if this man, so strong a force for goodness, justice and peace, is attacked, who then among us is safe?" Medeiros said. "What a tragic example of the dwindling regard and respect for human life. . . . When we remove God from the center of our lives, the vacuum is only too easily filled with evil or madness."

Some of the same sentiments were expressed, in simpler form, by Louise Rifkin, a Catholic who, accompanied by her Jewish husband, rushed inside St. Patrick's Cathedral in midtown Manhattan yesterday after hearing the news.

"They take potshots at the president, and the the pope," she said, fighting back tears. "What kind of a world is it? It's a sad day."

Cardinal Cooke said a special mass for the pope at St. Patrick's Cathedral late yesterday afternoon as, across the country, prayers were offered for his recovery.

"I never saw so many young people so shocked," said Bishop William E. McManus in South Bend, Ind., after 550 students graduating from Catholic elementary schools were told of the shooting during a mass. "There was a silence that moved over the children. A few cried. Their reactions spoke more than words could have."

The official reaction of the Catholic hierarchy came in a statement issued by Archbishop John R. Roach of St. Paul, the president of the National Conference of Catholic Bishops.

"I feel a profound sense of shock that the prince of peace has been felled by an assassination attempt," he said. "Once more a tragic spiral of violence that has so often engulfed the world has reached out to harm not just the leader of the church but all persons of decency and good will."

Other religious leaders echoed Roach's remarks.

"This is the latest and most tragic demonstration of the epidemic of violence and terrorism that now threatens world order," said Rabbi Marc H. Tannenbaum, national interreligious affairs director of the American Jewish Committee. "Together with other people of all faiths, the American Jewish Committee condemns the religious and ideological fanaticism which has now sought to destroy the life of one of the great moral and spiritual leaders of this generation."

Mormon Church President Spencer W. Kimball called the shooting "lamentable and tragic," while the National Council of Churches, meeting yesterday in Philadelphia, adopted a resolution demanding "an end to violence and the ever-increasing manufacture and distribution of the instruments of human destruction."

"In unity with Christians and believers of all faiths," the resolution said, "we pray that despite instances of evil, terror and violence, the goodness and peace to which the pope has dedicated his life will triumph in the world."

Many of the church leaders cited the shooting of the pope as the latest example of the need for a national gun control law and more stringent restrictions on the manufacture and sale of weapons around the world.

The shooting had one concrete immediate result in terms of the gun control debate in the United States. The Connecticut State Senate, which on Tuesday had defeated a gun control bill by a 19 to 17 vote, reversed itself and, by a vote of 18 to 17, approved the same measure, sending it to Gov. William A. O'Neill, who has not taken a public position on it.

"I thought it was the right thing to do in view of the shooting," said Sen. Margaret E. Morton in explaining her switch in position that made passage of the legislation possible.