The 22-year-old will spend the 2023-24 campaign at Pittodrie after a six-month loan spell with Blackpool during the first half of the 2022-23 season.
Williams was a regular for the Tangerines with 17 appearances in all competitions, but he was recalled to Anfield in January due to Liverpool's injury problems at the back.
However, the centre-back did not play a single senior game for the Reds last season, only making the bench on three occasions and being restricted to five games for the Under-21s in the Premier League 2.
Williams becomes the second player to make the switch to Aberdeen from Liverpool this summer after Leighton Clarkson joined on a permanent deal, and the defender hailed his teammate's influence in his decision to move to Pittodrie.
Speaking to afc.co.uk, Williams said: "I'm really pleased to be here. When I knew there was an opportunity to come to Aberdeen on loan I spoke to Leighton and he couldn't speak highly enough about his experience.
"I actually met some of the boys during the summer so there will be a few familiar faces in the dressing room which I'm sure will help me settle quickly. There's a lot to look forward to this season, particularly with European football, and I can't wait to get started and show everyone what I am capable of."
Aberdeen boss Barry Robson added: "Coming from Liverpool, Rhys joins us with a great pedigree. He's athletic, tall and we think we can improve him and give him the platform to continue his development. I've no doubt he'll become a real asset for the team.
"We've developed a good understanding with Liverpool, and I think they trust us with their players. The squad is starting to take shape now ahead of what will be a busy season. That said, we have still got a lot of work to do, and I expect the next few weeks will be busy with more new arrivals."
Williams has been on the books at Liverpool since 2011 and has progressed through the youth system to make 19 appearances for the first team under Jurgen Klopp.
All of Williams's senior matches in Merseyside red came during their injury-hit 2020-21 season, starting Liverpool's final five Premier League wins to ensure a place in the Champions League and earning high praise alongside Nat Phillips.
The former England Under-21 international has also been sent out on loan to Kidderminster Harriers and Swansea City during the early stages of his career and becomes the third Reds player to leave the club temporarily this summer after Calvin Ramsay (Preston North End) and Harvey Davies (Crewe Alexandra).