Obama faced his first veto override at a time when he is only four months away from completing his eight-year presidency.
The House of Representatives voted 348-77 against the veto, hours after the Senate rejected it 97-1, meaning the "Justice Against Sponsors of Terrorism Act" (JASTA) will become law.
The rare act of bipartisanship was a blow to Obama, who lobbied hard against the bill.
White House Press Secretary Josh Earnest called the Senate vote "the single most embarrassing thing" the legislative body has done in decades.
Then, when advised by military leaders of the bill's negative impact on our servicemembers - they override the veto anyway. Embarrassing.
— Josh Earnest (@PressSec) September 28, 2016
"Ultimately these senators are going to have to answer their own conscience and their constituents as they account for their actions today," he told reporters traveling with Obama in Richmond, Virginia.
Coming in Obama's last months in office, the vote shows the White House to be much weakened.
Obama has issued 12 vetoes during his presidency. None have been overridden until now, a rare feat given Republicans' longstanding control of Congress.
The White House argued the 9/11 bill would undermine the principle of sovereign immunity, exposing the US to lawsuits.
In a letter to Republican and Democratic Senate leaders, Obama said: "I strongly believe that enacting JASTA into law would be detrimental to US national interests."
Obama warned of "devastating" consequences for the Pentagon, service members, diplomats and the intelligence services.
It would "neither protect Americans from terrorist attacks, nor improve the effectiveness of our response to such attacks," he warned.
— (@Adhwan) September 28, 2016
"The United States relies on principles of immunity to prevent foreign litigants and foreign courts from second-guessing our counterterrorism operations and other actions that we take every day."
Saudi Arabia and 9/11
Families of 9/11 victims have campaigned for the law, convinced the Saudi government had a hand in the attacks that killed almost 3,000 people.
Fifteen of the 19 hijackers were Saudi citizens, but no link to the government has been proven. The Saudi government denies any ties to the plotters.
Declassified documents showed US intelligence had multiple suspicions about links between the Saudi government and the attackers.
"While in the United States, some of the 9/11 hijackers were in contact with, and received support or assistance from, individuals who may be connected to the Saudi government," a finding read.
The bill's co-sponsor, New York Democrat Chuck Schumer, told senators it "would allow the victims of 9/11 to pursue some small measure of justice."
Behind the scenes, Riyadh has been lobbying furiously for the bill to be scrapped.
A senior Saudi prince reportedly threatened to pull billions of dollars out of US assets if it becomes law, but Saudi Arabian officials now distance themselves from that claim.
The US-Saudi relationship had already been strained by Obama's engagement with Saudi Arabia's foe Iran and the July release of a secret report on Saudi involvement in the 9/11 attacks.