An Iraqi Army major quoted by Reuters said the military had decided to give the refinery priority over the city, believing that a fight for the city would allow ISIS to drag them into another war of attrition.
ISIS had been pushing into Baiji for awhile, and had the troops pinned down in the courthouse in the center of the city. It is likely that ISIS will push into the refinery area again soon.
Baiji Refinery is the largest oil refinery in Iraq, but has been shut down more or less since summer, with ISIS and the military both holding portions of it most of the time.
Iraqi officials had presented the retaking of Baiji as proof that they had shifted momentum against ISIS. The loss of the city suggests that the momentum shift was nowhere near as significant as advertised.