At the first public draw at Buckingham Palace, Samoa were the first nation to be pulled out of the hat by Harry in his first engagement since he and his wife quit as senior royals.
It means the hosts will kick off the tournament against Samoa at St James' Park, Newcastle, on October 23, 2021.
Williams, who has switched codes after representing the All Blacks at last year's World Cup in Japan, played for New Zealand in rugby league's showpiece tournament in 2013 but is also eligible for Samoa and has yet to announce his choice.
England's other Group A opponents, drawn by dual-code international Jason Robinson and 2012 Olympic rowing gold-medal winner Dame Katherine Grainger, will be France and World Cup debutants Greece.
Venues for the rest of the matches will be determined over the next few weeks.
Scotland were drawn in Group B alongside holders Australia, Fiji and Italy while John Kear's Wales face Pacific Island opponents Tonga, Papua New Guinea and Cook Islands.
In the other group, New Zealand were paired with Lebanon, Jamaica and Ireland.
England will play newcomers Brazil in the opening match of the women's World Cup and will also take on Papua New Guinea and Canada in the group stage, while Australia were paired with New Zealand, France and the Cook Islands.