Wilson, 27, joined the Latics from Bristol City in January 2014, making 109 appearances for the club.
The Cardiff-born player won his only Wales cap in a World Cup qualifier against Belgium in October 2013.
"James is an athletic, mobile centre-half and knows this division," manager Chris Wilder told the club website.
"We've had him with us for a few days, had a good look at him and he will be a good addition to our squad."
Find all the latest football transfers on our dedicated page.
Sheffield United have signed centre-back James Wilson on a two-year contract after he rejected a new deal at League One rivals Oldham Athletic.