Milnes, 22, who has been on loan with Derbyshire this season, was not offered new terms by his parent club.
Derbyshire's elite performance director Graeme Welch had previously worked with Milnes when he was the Bears' bowling coach at Edgbaston.
"Tom is a talented young lad," said Welch. "He has impressed me both on and off the field.
Milnes said: "I've enjoyed my loan spell with the club and feel that this is the right place for me to develop my game and produce runs and wickets."
Derbyshire have signed all-rounder Tom Milnes from Warwickshire on a two-year contract.