Cargill came through the academy system at Bournemouth, but the 23-year-old went on to make just 11 first-team appearances for the Cherries before being released at the end of last season.
However, MK Dons have moved to boost their chances of an immediate return to League One by adding Cargill to their fast-changing squad.
New boss Paul Tisdale told the club's official website: "Baily is a player I've admired for a number of years, ever since I saw him play for England Under-20s, and the opportunity arose this summer to bring him here.
"He's a left-sided defender who has had lots of experience from loan spells but, I'm sure, will be pleased to have found somewhere where he can cement a place and demonstrate his ability over a period of time.
"I'm looking forward to seeing how he does, as he looks to take his career forward - I believe we're the perfect fit."
MK Dons have now made nine signings ahead of the start of the new campaign.