The Senate overrode the veto in a 97-1 vote, followed a short time later by the House of Representatives, which knocked it down with a 348-77 vote.
The rare act of bipartisanship was a blow to Obama, who lobbied hard against the bill, known as the Justice Against Sponsors of Terrorism Act (JASTA).
Obama called Wednesday's vote a "dangerous precedent."
"I understand why it happened," he said on CNN. "Obviously, all of us still carry the scars and trauma of 9/11."
But he said the decision would harm US national interests by undermining the principle of sovereign immunity, opening up the United States to private lawsuits over its military missions abroad.
"Our men and women in uniform around the world could potentially start seeing ourselves subject to reciprocal loss."
Some of the lawmakers who voted for the override didn't know what was in the bill, he said, calling the result "basically a political vote."
White House press secretary Josh Earnest earlier called the Senate vote "the single most embarrassing thing" the legislative body has done in decades.
"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.
His Republican predecessor George W. Bush also issued 12 vetoes, of which four were overridden. The last president to avoid an override was the legendary Democratic congressional dealmaker -- and former senator and congressman -- Lyndon Johnson.
Signup to our newsletter and follow us on Facebook and Twitter!
- 'Devastating consequences' -
In a letter to Republican and Democratic Senate leaders obtained by AFP, Obama had previously warned of "devastating" consequences for the Pentagon, service members, diplomats and the intelligence services.
The 9/11 measure would "neither protect Americans from terrorist attacks, nor improve the effectiveness of our response to such attacks," he warned.
"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."
RNC chair Reince Priebus said Obama's veto "showed remarkable disregard for the families of 9/11 victims, and the Senate has done the right thing by overwhelmingly overriding his poor decision."
Meanwhile Republican Florida Senator Marco Rubio said the override was "about holding anyone who supports terrorists accountable, and getting their victims the justice they deserve."
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 lobbied furiously for the bill to be scrapped.
A senior Saudi prince reportedly threatened to pull billions of dollars out of US assets if it were to become law, although Saudi officials now distance themselves from that claim.
The US-Saudi relationship had already been strained by Obama's engagement with Saudi's Shia foe Iran and the July release of a secret report on Saudi involvement in the 9/11 attacks.