The idiom “to burn the midnight oil” originated from the days when people used oil lamps for light. Working or studying until late night meant literally burning oil.
\(⇒\) Therefore, it refers to working hard late into the night, especially on important tasks or studies.