The 29-year-old Briton replaces Germany's Adrian Sutil in the role as back-up to race drivers Felipe Massa and Valtteri Bottas.
Di Resta raced for three seasons in Formula One with the Force India team between 2011 and 2013 with a best result of fourth.
"It will be a busy year combining both driving in DTM (German Touring Cars) with Mercedes AMG, and attending the Formula One Grands Prix in my new reserve driver role," said the Scot in a statement.
"I will be giving my full support to both and look forward to the exciting possibilities the year has ahead."
Mercedes-powered Williams finished third overall last season.