Warnock, 31, turned down the chance to join the Hammers and completed his medical at Thorp Arch.
United boss Neil Warnock - who is not related - said: "I'm absolutely delighted. Stephen has the experience I think we need in that position.
"He is a former international who, for whatever reason, has been allowed to leave Aston Villa.
"He's a player I've tried to sign a few times before and I'm pleased he turned down West Ham to come here."
Warnock has played over 200 times in the Premier League for Liverpool, Blackburn, and Aston Villa.
He began his career with Liverpool before moving to Blackburn in a £1.5m deal in 2007. He left Rovers in 2009 to join Villa but he has fallen out of favour under Paul Lambert.
He spent three months on loan at Bolton this season, making 15 appearances.