The 25-year-old joins the Saddlers after turning down fresh terms at League Two rivals Carlisle United earlier this summer.
Riley came through the ranks at Old Trafford and played twice for the first team – featuring in both the FA Cup and Europa League – before spells with Bradford City and Carlisle. He can play in both full-back positions and central midfield.
"I’m excited. To hear the ambitions of the club and to be a part of that this season and the one after is something I’m ready to buy into," said Riley.
“I’ve played 84 games in the last two seasons and I feel confident within myself. I’ve come on, not just in terms of learning League Two, but mentally as well.
“I feel I am more experienced now and I can help the younger players but as well, I’m in a position where I want to learn from other players.”
Having joined Carlisle in August 2020, Riley went on to feature regularly over two seasons at Brunton Park and scored five goals.
He also had a brief loan spell at Sheffield United in 2017.
Walsall boss Michael Flynn added: "Joe is an exciting player.
“He came through at Manchester United and he’s getting better and better.
“He’s at a great age, 25 and I’m really excited to be working with Joe.
“He’s definitely one who can make his mark on Walsall and on the league next season.”