Williams, who can play in central defence or midfield, could make his debut in Tuesday night's Championship match against Sheffield Wednesday.
The fee is undisclosed but Dons boss Karl Robinson said the club could not afford to lose Williams for nothing as his contract was up in the summer.
Robinson told the Dons' official website: "He is going to be a big loss to the football club. His contract was due to run out at the end of the season and although we offered him a new deal, he's decided to move on and we've got to respect that.
"I'm just extremely grateful and thankful to Shaun for all he's done for me and the football club and I wish him all the best in this new chapter of his career. He'll always be welcome back at stadiummk whether that be as a fan or as a player."
Williams has scored 10 goals for the Dons this season in 33 games.