The Miami Heat released Williams, 25, on Tuesday. He averaged 5.9 points and 2.9 rebounds over 25 games for the Heat.
"He can play the 3 and the 4," Cavs coach Tyronn Lue said of Williams. "He's a good defender on-ball. Has athleticism. So, I'll just try to work him in with that second unit, let LeBron handle it, let him play off LeBron a little bit with [Kyle] Korver and those guys and just see how we can get him acclimated."
The Cavs had an open roster spot for the past month, and LeBron James has urged the team to sign a backup point guard. Last week, the team worked out a handful of veteran guards but ultimately passed on signing any of them.
Because of a season-ending injury to center Chris Andersen, the Cavs are down to three big men: Tristan Thompson, Kevin Love and Channing Frye. Guards Iman Shumpert and J.R. Smith also are out with injuries.
ESPN's Dave McMenamin contributed to this report.