They will play in men’s and women’s singles rubbers before meeting in the mixed doubles alongside partners Belinda Bencic and Frances Tiafoe.
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 are the defending champions, Federer and Bencic having won the event in Perth in January 2018.
Meanwhile, organisers have announced that prize money at next month’s Australian Open will rise by 14% to AUS$62.5m (£34.5m).
There will be a 25% increase for those who lose in the first round: players who reach the main draw are now guaranteed at least AUS$75,000 (£41,400).
The singles’ champions will each take home $4.1m (£2.26m).
The total prize fund has increased by 89% over the past five years.
“We have a responsibility to improve the conditions for all the players, and ensure tennis offers a viable career path, and this means increasing prize money as well as easing the costs associated with playing the Australian Open,” said Australian Open chief Craig Tiley. (Courtesy BBC Sport)