The 34-year-old made 51 appearances in all competitions for the Gills last season, keeping 14 clean sheets.
Manager Justin Edinburgh told Kent Online: "I know that all of our out-of-contract players would have attracted interest, which is no surprise.
"They are good quality players who had very good seasons. We knew we had competition with Nels.
"He always wanted to stay here but if you have a good season then that is what happens. We did well as a team last season and as individuals and when players are out of contract this is what can happen."
Former Brentford, Leyton Orient and Notts County keeper Nelson moved to Priestfield in 2012 and has featured a total of 179 times for the club.