The draw was made at a ceremony in Nyon, Switzerland, on Monday, Polish state news agency PAP reported.
Legia were paired with Molde FK of Norway, European football's governing body UEFA said.
The first match will be played in Norway on February 15 and the return leg in Poland on February 22, officials announced.
The winners will go through to the last 16 of the 2023/2024 UEFA Conference League.
Last week, Legia progressed to the knockout stages of the competition, finishing second in Group E after a 2-0 win over AZ Alkmaar of the Netherlands.
The final of the 2023/2024 UEFA Conference League, Europe's third-tier club competition, will be held on May 29 in Athens, Greece.
(pm/gs)
Source: PAP, UEFA