The financial terms of the deal weren't available. Leonhard is joining linebacker Bart Scott, who signed a six-year, $48 million contract last weekend with the Jets.
Leonhard, 26, came to the Ravens last year and established himself as a value safety for Ryan's defense in Baltimore. Ryan was the Ravens' defensive coordinator until he accepted the head coaching job with the Jets.
"I am extremely excited to become a New York Jet," Leonhard said in a statement. "Obviously, to be reunited with coach Ryan and coach [Mike] Pettine on the defensive side of the ball is a great opportunity. I am really excited to get in there this first year with coach Ryan and hopefully help do some great things."
In 16 games with the Ravens last year, Leonhard, who is 5-foot-8, 186 pounds, had 69 tackles and returned one interception for a touchdown. He visited the Jets during the weekend and left without a contract.
The deal was worked out Tuesday morning.
Ryan had high praise for Leonhard after the free-agent period began.
"Jim Leonhard is special," Ryan said. "No. 1, he looks like the guy delivering papers. He really is a smart player. He has a lot of poise. He's very sure of himself.
"For some reason he gets saddled because he's short, but this guy's an outstanding athlete. He won two slam-dunk contests at the University of Wisconsin. He's an outstanding punt returner. I've always said he could catch a punt in a hurricane.
"He's a smart, tough, passionate guy. You try to build your team with those kinds of players."
John Clayton covers the NFL for ESPN.com. ESPN.com's Tim Graham and The Associated Press contributed to this report.