The two countries were both unseeded for the draw in Zurich and Northern Ireland were paired with Switzerland while the Republic will face Denmark.
The two-legged ties will take place between November 9 and 14, with Northern Ireland at home in the opening leg, while the Republic will host Denmark in their return fixture.
Switzerland were the highest-ranked nation in the draw and will be a stern test for Michael O’Neill’s side as they look to qualify for their first World Cup since 1986.
Denmark, meanwhile, are ranked only seven places higher than the 26th-ranked Republic of Ireland. And while Martin O’Neill insists it is still a tough ask, he did admit to satisfaction at missing out on a tie against the Azzurri.
“Naturally as an unseeded team the draw was going to be difficult,” O’Neill said.
“I’m delighted to be drawn away from home first. Italy were in the group and I suppose if you were to ask all of the unseeded coaches, none of us would have wanted to play Italy.”
A James McClean goal was enough for the Republic to beat Wales last week to seal their spot as runners-up in Group D. They ended their qualification group-stage campaign on 19 points as Serbia topped the group.
Denmark missed out on the 2014 World Cup but finished second in Group E behind Poland as they look to book their fifth appearance at the finals.
Northern Ireland lost to Germany and Norway in their final two qualifiers but still finished four points clear of the Czech Republic to seal their place in the play-offs.
They finished behind Group C winners Germany as they look to follow up their performance at Euro 2016 with a rare outing at the World Cup.
Switzerland were unlucky not to reach the finals as winners of Group B, ending the campaign with nine wins from their 10 qualifiers. They lost to Portugal in the final game of the group to finish behind the European champions and sit 11th in the world rankings. But Northern Ireland boss Michael O’Neill revealed he was pleased to miss out on drawing either Italy or Croatia.
“We are pleased with the draw,” he said. “We are pleased we missed Italy and Croatia in particular and Switzerland will be a formidable opponent but I do believe it is an opponent we can overcome.”