Kennedy, 81, told the president and his colleagues he will step down July 31.
"For a member of the legal profession it is the highest on honors to serve on this court," he wrote. "Please permit me by this letter to express my profound gratitude for having had the privilege to seek in each case how best to know, interpret and defend the Constitution and the laws that must always conform to its mandates and promises."
The White House issued a statement thanking Kennedy for his years of "distinguished service."
"During his tenure on the court, he authored landmark opinions in every significant area of constitutional law, most notably on equal protection under the law, the separation of powers and the First Amendment's guarantees of freedom of speech and religion," the statement said.
"Justice Kennedy has been a tireless voice for individual rights and the founders' enduring vision of limited government. His words have left an indelible mark not only on this generation, but on the fabric of American history."
A news release from the Supreme Court said Kennedy wishes to spend more time with his family, though they were willing for him to continue serving.
"He said, too, that admiration for his colleagues on the Court means that he will retain warm ties with each of them in the years to come," the court's statement said.
Former President Ronald Reagan nominated Kennedy to the high court in 1987 and he was sworn in on Feb. 18, 1988. Kennedy was Reagan's third choice for the seat vacated by Lewis F. Powell Jr. His first two nominations -- onetime Attorney General Robert Bork and appellate judge Douglas Ginsburg -- were both rejected by the Senate.
Throughout his tenure on the Supreme Court, Kennedy often served as a swing vote, not always siding with the same political ideology. He wrote the majority opinion for Obergefell vs. Hodges, legalizing marriage equality nationwide, and Citizens United vs. the Federal Election Commission, which protects campaign spending by corporations under the First Amendment.
Republicans in the Senate will be eager to fill Kennedy's seat before the midterm elections, when the GOP could lose control of the chamber
Senate Republican leader Mitch McConnell of Kentucky addressed Kennedy's retirement from the Senate floor.
"The Senate stands ready to fulfill its constitutional role by offering advice and consent ... we will vote to confirm Justice Kennedy's successor this fall," he said.
Senate Democratic Whip Dick Durbin of Illinois thanked Kennedy for his decades of service. He called for the Senate to hold off confirming his replacement nominee until after the midterm elections, citing the Senate's delay on voting on President Barack Obama's nominee, Merrick Garland, until Trump's election.
"Senator McConnell set the new standard by giving the American people their say in the upcoming election before court vacancies are filled," Durbin said. "With so much at stake for the people of our country, the U.S. Senate must be consistent and consider the president's nominee once the new Congress is seated in January."