Williams, 33, joined Everton from Swansea for a reported fee of £12 million ($16m) in 2016, having helped Wales reach the semi-finals of Euro 2016.
The centre-back, rumoured to be a long-term target for Arsenal during his time with the Swans, will be tasked with helping Stoke return to the top flight after their relegation from the Premier League last season.
The arrival of Williams follows the permanent signing of Oghenekaro Etebo, Tom Ince, Adam Federici and James McClean, while Benik Afobe has also moved to Stoke on loan from Wolves.
"We have two very good senior central defenders in Ryan Shawcross and Bruno Martins Indi but I felt it was important we brought in another experienced player to add to the competition for places," Stoke manager Gary Rowett said in a statement.
"He has gone for big money in the past and had a fantastic a career so far and experience in that position can be key because it can help you read the game."
Williams made 60 Premier League appearances during his two years at Goodison Park, having also been a stalwart and first-team regular during an eight-year stay with Swansea.