President Reagan yesterday signed legislation that will permit recuperating White House press secretary James S. Brady to receive charitable contributions to help pay continuing medical expenses.

The legislation exempts Brady from a law that bars federal employes from receiving gifts from private groups while on government salary. It would apply to any federal employe wounded in an assassination attempt on a president, vice president, member of Congress or someone who has been elected to these offices but has not been sworn in.

Brady has been receiving his $60,000 annual salary since he was shot in the head during an attempt on Reagan's life as the president left the Washington Hilton on March 30, 1981. Reagan was wounded.

The president's action yesterday, taken without fanfare at the White House, is the prelude to what is expected to be a $5 million fund-raising drive to defray Brady's future medical expenses and pay for his son, Scott's, education.

The fund drive tentatively is scheduled to be announced on May 3 by Nancy Reagan. Most details of it remain to be decided.

Co-chairmen of the drive will be Robert S. Strauss, former Democratic national chairman, and Joe Rodgers, former Republican national finance chairman.

Others associated with the effort include White House counsel Fred Fielding and deputy chief of staff Michael K. Deaver, attorneys James Lynn and James Wilderatter and CBS correspondent Bill Plante.

Strauss said yesterday that fund-raising would be conducted "in good taste and in a way that would reflect credit on the office of president."

Brady, who has recovered far beyond early expectations, was readmitted to George Washington University Hospital on March 30, a year after he was wounded, because of a blood clot and an inflamed vein in his leg. He was reported in good condition yesterday.

Workmen's compensation has paid for most of Brady's medical expenses, including the installation of an elevator in his home and other special equipment. But friends of the family said yesterday that charitable contributions would be needed once the limit of the workmen's compensation program is exceeded.

Originally, Brady's friends said they did not believe legislation was needed to set up a charitable group in his behalf. After receiving a legal opinion that such contributions would violate the law as long as Brady remained on federal salary, Sen. William V. Roth Jr. (R-Del.) and House Minority Leader Robert H. Michel (R-Ill.) rushed legislation through Congress, creating the exemption.

Reagan has promised to hold Brady's job open for him until he is able to return to work. In recent interviews Brady said that he expects to return to the White House as press secretary eventually.