The 25 year old was on the books at Pompey as a youngster 7 years ago, and joins up with former Rotherham boss Kenny Jackett when his current deal with the Millers runs out on July 1st.
Williams made 89 appearances for the Millers scoring 5 goals.
Jackett told Pompeys official site; “Ryan is out of contract and we’re pleased that he’s chosen Pompey, who were his first club many years ago. He’s an attacking winger who can play on either side and ensures we have good competition in that area.
“Ryan’s just made his debut for Australia, but has been in England for many years now and established himself, He speaks very fondly of this club and has continued to follow them. He’s delighted to come back and is doing so in his prime.”