The Polish side, managed by Romanian coach Edward Iordanescu, had drawn 2–2 in the first leg in Ostrava last week.
Legia will now face Cypriot club AEK Larnaca in the next round.
Thursday’s return leg in Warsaw was decided in the second half, with goals from Cameroonian striker Jean-Pierre Nsame in the 54th minute and an own goal by Baník’s Karel Pojezny in the 74th.
Baník took the lead early, with Erik Prekop scoring in the 15th minute. In the 90th, Baník's David Buchta missed a penalty, sealing the win for Legia.
In last week’s first leg, Legia’s Bartosz Kapustka scored in the 32nd minute, followed by a late header from Nsame in the 88th. Baník’s goals came from Matěj Šín and Michal Frydrych.
Legia reached the second round after defeating Kazakhstan’s Aktobe 1–0 in both legs of the first qualifying round.
To reach the Europa League group stage, Legia must get past AEK Larnaca and win one additional qualifying round.
Legia, last season’s Polish Cup winners, claimed the Super Cup Cup in July, beating national champions Lech Poznań 2–1.
Lech, meanwhile, advanced in the Champions League qualifiers on Wednesday after eliminating Icelandic side Breiðablik.
They will now face Serbia’s Red Star Belgrade in the third qualifying round as they continue their quest to reach the Champions League group stage.
(gs)
Source: IAR, PAP