The bill, which passed the House and Senate with unanimous approval, guarantees that family members of deceased soldiers continue to receive death gratuities and other survivor benefits from the Pentagon.
On Wednesday, the White House said Obama was "disturbed" to find that families of fallen troops weren't receiving death benefits during the shutdown.
The administration had worked out a temporary solution before the bill was signed, in which the Fischer House Foundation would make payments to the soldiers' families from its own funds. The Defense Department planned to reimburse the foundation at the end of the shutdown.
More from the Associated Press:
WASHINGTON — WASHINGTON (AP) — Families of fallen troops will be assured of receiving death benefits under legislation President Barack Obama signed Thursday amid a national firestorm over the payments being suspended during the partial government shutdown.
Obama signed the bill into law after it won final passage in the Senate earlier in the day.
Obama's chief spokesman, Jay Carney, had said Thursday that the measure was unnecessary because a military charity had stepped in to continue the payments during the shutdown. The Pentagon had said the lapse in funding meant it had no authority to continue the payments, but that explanation did not sit well with members of Congress in either party.
The Pentagon typically pays out $100,000 within three days of a service member's death. Twenty-nine service members have died during active duty since Oct. 1, when parts of the government closed.
The Pentagon infuriated congressional Republicans and Democrats when it said a law allowing members of the military to be paid during the shutdown did not cover the death benefit payments. Congress passed and Obama signed that measure into law before the government shutdown began, and lawmakers insisted that the benefits shouldn't have been affected.
In stepped a charity, the Fisher House Foundation, which Defense Secretary Chuck Hagel said Wednesday would cover the costs during the shutdown. Hagel said the Pentagon would reimburse the foundation after the shutdown ended.
The administration said the Pentagon's agreement with Fisher House would remain intact until the government can get the program up and running again to make sure the benefits are delivered without further interruption.
Sen. John Cornyn, R-Texas, said Thursday that the organization is "extraordinarily generous and they do very good work," but he pressed for Senate passage of the benefits bill to ensure the Defense Department and Fisher House wouldn't have to figure out a special work-around.
The government could not actively solicit funds from private organizations but could accept an offer.
Senate Majority Leader Harry Reid, D-Nev., said the Pentagon had essentially resolved the problem and the issue was moot, but he didn't object to passage of the bill.
Across the Capitol, Republicans on a House Armed Services panel excoriated Pentagon comptroller Robert Hale, accusing him of playing politics with his interpretation of the original law. They said the law was designed to pay the death benefits as well as keep all Defense Department civilians on the job — not to select the most essential.
"You went out of your way to make this as ugly as possible, to inflict as much pain as possible on this department," said Rep. Mike Coffman, R-Colo., who introduced the first bill days before the shutdown in an attempt to exempt the military.
Hale responded that the law was poorly written and there never should have been a shutdown in the first place.
"I resent your remarks," the budget chief said. "I acted on the advice of attorneys and our best reading of a loosely worded law."
Associated Press writers Pauline Jelinek and Darlene Superville contributed to this report.