The deal follows following a loan spell with Gills in 2019-20, when he made seven appearances.
But in six and a half seasons, he played just 17 first-team games before being released in July.
Steve Evans' Gillingham, who finished 10th in League one last season, have now made five summer signings - with Graham following forward Vadaine Oliver, midfielder Jacob Mellis and defenders Zech Medley and the returning Ryan Jackson.
"Jordan was one of our key targets," said Evans. "The lad and his father in particular has spoken at length with numerous clubs.
"They have made an informed decision that we are his clear choice. There will be a number of high-profile managers in League One who will be disappointed."
Need a VPN? Or seeking to switch? Then support Tribal Football by clicking here to sign up with our official partners NordVPN. Not only will you receive the best VPN experience, but also great discounts by signing up via Tribal Football. Thanks for your support!