Terms of the trade were not disclosed.
The Lions get their replacement for Ndamukong Suh, who was expected to sign with the Miami Dolphins after the 4 p.m. ET start to free agency, and the Ravens free up $8.5 million of much-needed cap space. Ngata had a team-high $16 million cap figure.
The Ravens were attempting to sign Ngata to an extension, but the sides never got close to a deal.
Ngata, 31, is a five-time Pro Bowl player who had been the foundation for the Ravens' run defense. He had his best season in recent memory last year before getting suspended four games for violating the league's policy on performance-enhancing drugs.