The Magic will receive cash considerations and the right to swap second-round draft picks with the Knicks in 2019, sources said.
The fourth year of O'Quinn's contract is a player option, sources said.
O'Quinn, 25, is an aggressive, physical frontcourt player. He averaged 5.8 points and 3.9 rebounds in 51 games with the Magic last season.
A New York native, O'Quinn was a second-round draft pick of the Magic in 2012.