Cosby, 83, was the first celebrity tried and convicted in the #MeToo era, and his conviction was seen as a turning point in the movement to hold powerful men accountable for sexual misconduct.
Here's a look at the case against Cosby and the court's decision:
SEE ALSO: Bill Cosby leaves prison after court overturns sex assault conviction
ABC News Special Report: Bill Cosby freed from prison, his sex conviction overturned
WHY DID THE COURT TOSS HIS CONVICTION?
The split court found that Cosby was unfairly prosecuted because the previous district attorney had promised the comedian once known as "America's Dad" that he wouldn't be charged over Constand's accusations. Cosby was charged by another prosecutor who claimed he wasn't bound by that agreement.
The court said that's not the case. The justices found that Cosby relied on that promise when he agreed to testify without invoking his Fifth Amendment right against self-incrimination in a lawsuit brought against him by Constand.
The court concluded that prosecutor who later brought the charges was obligated to stick to the nonprosecution agreement, so the conviction cannot stand. The justices wrote that "denying the defendant the benefit of that decision is an affront to fundamental fairness, particularly when it results in a criminal prosecution that was foregone for more than a decade."
SEE ALSO: Bill Cosby conviction overturned: Timeline of events leading to actor's release
Bill Cosby to leave prison after court overturns sex assault conviction
WHAT'S THE DEAL WITH THE NONPROSECUTION AGREEMENT?
The promise not to prosecute Cosby was made in 2005 by Bruce Castor, who was then the top prosecutor for Montgomery County. Castor was also on the legal team that defended former President Donald Trump during his historic second impeachment trial over the Jan. 6 insurrection at the U.S. Capitol by his supporters.
During a court hearing weeks after Cosby's 2015 arrest, Castor testified that he promised Cosby he wouldn't be prosecuted in the hopes that it would persuade the actor to testify in a civil case brought by Constand and allow her to win damages. Castor acknowledged the only place the matter was put in writing was in the 2005 press release announcing his decision not to prosecute, but said his decision was meant to shield Cosby from prosecution "for all time."
His successor noted, during the appeal arguments, that Castor went on to say in the press release that he could revisit the decision in the future.
Castor had said that Constand's case would be difficult to prove in court because she waited a year to come forward and stayed in contact with Cosby.
The first jurors who heard the case may have agreed with him, as they could not reach a verdict in 2017. But a second jury empaneled after the #MeToo movement exploded found him guilty at his 2018 retrial. Constand settled her civil case against Cosby for more than $3 million.
Castor's successor, District Attorney Kevin Steele, charged Cosby in 2015 after a federal judge, acting on a request from The Associated Press, unsealed documents from her 2005 lawsuit against Cosby, revealing his damaging testimony about sexual encounters with Constand and others. Castor has said Cosby "would've had to have been nuts to say those things if there was any chance he could've been prosecuted."
SEE ALSO: DA: Cosby's release is "irrelevant to the facts of the crime"
Court overturns Bill Cosby's conviction, bars further prosecution
HOW RARE IS THIS?
Extremely rare.
Wesley Oliver, a Pennsylvania law professor who has followed Cosby's case closely over the years, said he has never heard of a high court in Pennsylvania or anywhere else grappling with a prosecutor's informal promise not to prosecute.
"It breaks new ground entirely," said Oliver, who teaches at Duquesne University School of Law in Pittsburgh. "It sets precedent not just for Pennsylvania but probably other states."
He said the ruling should drive home to prosecutors the risks of suggesting at news conferences, in press releases or verbally in private that they will not prosecute.
"They should at least add three words - 'at this time,'" he said. "If you add that qualifier, which wasn't done in Cosby's case, you should be good to go," Oliver said.
CAN COSBY BE TRIED AGAIN?
It's highly unlikely. The decision on Wednesday bars Cosby from being tried again over Constand's complaint, finding it to be the "only remedy that comports with society's reasonable expectations of its elected prosecutors and our criminal justice system."
And the accusations raised by dozens of other women, including the five who testified at his 2018 trial, often go back decades and are most likely too remote to prosecute.
Cosby turns 84 next month. However, his lawyer said he remains in good health, except for vision problems that render him legally blind.
The trial judge deemed him a sexually violent predator who could still pose a danger to women given his wealth, power and fame, and ordered that he be on a lifetime sex offender registry and check in monthly with authorities. However, the decision negates that finding.
The Associated Press contributed to this report.