The 26-year-old turned down the offer of a new contract with the Spireites, who lost manager Paul Cook to Portsmouth at the end of the season after their unsuccessful League One play-off campaign.
Ryan began his career as a Liverpool trainee before stints with Shrewsbury, Accrington and Scunthorpe United.
Fleetwood boss Graham Alexander said: “Jimmy is a very good player first and foremost. We know of his qualities having played against us for Chesterfield.
“He has always been a difficult player to come up against so we are delighted to bring him to Fleetwood. We have spoken about the profile of player we want at the club and he certainly fits into that category.
“He will help our younger players with his experience even, though he is only 26. He has played a lot of games and I think he will fit into the squad perfectly. He will be a quality player for us.”
Ryan played 52 times for Chesterfield last season and was instrumental as they made the play-offs in their first season following promotion from League Two. He also scored four goals.