Nicholls will join Aidy Boothroyd's side on a free transfer and will officially become a Cobblers player on July 1.
The 24-year-old, who can play on the wing or up front, has spent his entire career at Walsall, making more than 200 appearances for the club and scoring 24 goals.
He was offered a new deal to remain at the Banks's Stadium but decided to make the move to Sixfields.
"There were a lot of clubs in for him and I'm delighted we've got him," said Boothroyd. "He is all action and he's extremely fit and extremely quick, we've got a really young talented player with lots of potential.
"He's really ambitious and I'm really excited about working with him. He has played a lot of his football at a level above League Two and has been a regular at that level, and for someone of his age he already has a lot of experience. He is also at an age where he will just get better and better."