The 20-year-old has been involved in Killie's first team over the past four seasons, debuting at 16 in 2012.
He has also been capped at Under-21 level for Scotland.
"He is a player that fits the bill perfectly," Dundee manager Paul Hartley told his club website. "Mark is at the right age and is someone we think we can work with and develop."
O'Hara has made over 80 senior appearances and follows Dutch forward Yordi Teijsse in moving to Dens Park.
"He is versatile and at a young age has played a lot of games already," added Hartley on O'Hara. "He can play right-back but we want to develop him in the middle of the park.
"He had a year left on his contract at Killie so we are delighted to secure his signing."
Dundee have signed defender Mark O'Hara from Scottish Premiership rivals Kilmarnock.