They will play in men's and women's singles rubbers before meeting in the mixed doubles alongside partners Belinda Bencic and Frances Tiafoe, BBC Sport reported.
Federer and Williams, both 37, have won a combined 43 Grand Slam titles.
"It is very exciting for both of us and I hope a lot of tennis fans tune in and watch it," said Federer.
Williams said it was "like a dream come true". She added, "I have been looking forward to it. This is so cool."
The match has been described as the most anticipated contest involving a male and female player since the "Battle of the Sexes" in 1973, when 39-time Grand Slam champion Billie Jean King beat former men's world number one Bobby Riggs in straight sets.
Despite their concurrent careers, Federer said it would be an "exaggeration" to say he knew Williams well.
"I admire everything she's done on and off the court, we are both fierce competitors and we always want to win," he said.
"It is going to be one time, probably never again. She is one of the biggest champions in our sport ever – men and women combined – so it is great to be playing against her."
The Hopman Cup comprises two singles and a mixed doubles match between nations in a round-robin format with two groups of four. The winners of each group will contest Saturday's final.
Federer and Bencic beat Britain's Cameron Norrie and Katie Boulter in their opening round-robin tie, while the USA lost to Greece on Monday despite Williams winning her singles tie.
Switzerland is the defending champion, Federer and Bencic having won the event in Perth in January 2018.