Williams will report to Oct. 1 to Detroit's training camp.
He was drafted No. 11 overall in the 2009 NBA draft by New Jersey, but hasn't played up to his potential.
The 6-foot-6 Williams averaged 8.4 points in 78 games, including nine starts, as a rookie for the Nets. They traded him to Houston during his second season in the league after he repeatedly broke team rules and played just 11 games. He averaged 8.8 points in 18 games last season in Sacramento and 4.5 points over 12 games with Houston. The 25-year-old Williams is from Seattle and was a standout for Louisville.