The deal sends Gortat and guards Shannon Brown, Kendall Marshall and Malcolm Lee to the Wizards for Okafor and a 2014 first-round draft pick that is protected through the top-12 selections.
Gortat, 29, started 61 games last season for Phoenix, averaging 11 points and 8.5 rebounds a game.
Okafor, who will be entering his 10th season and whose contract expires this season, averaged 9.7 points and 8.8 rebounds a game. His scoring average has dropped each of the past six seasons. Okafor has missed the entire preseason with a herniated disk in his neck and the Wizards had not set a timetable for his return.