The 35-year-old, who spent a loan period with Northampton in the 2011-12 campaign, was one of Bradford's star performers last season.
"Matt was always our number one keeping target this summer and I am delighted we have got him," Cobblers boss Aidy Boothroyd told the club's official website.
"I am really pleased that in each of the last two seasons we have got our top goalkeeping targets. We have done well to get Matt. We wanted an experienced keeper and Matt fits the bill perfectly.
"We know he will settle in quickly as he knows the club and he knows the staff and I think he will be another excellent addition to the squad."
Duke had previously been linked with a number of lower league clubs.