If an engineer or conductor is not qualified on a particular territory, they will be assigned an engineer or conductor pilot who is qualified. Sometimes, the Road Foreman responsible for that territory will serve as a pilot.
When derailments happen, sometimes trains are re-routed to avoid the derailment. Those re-routes sometimes put crews on unfamiliar territory, thus requiring pilots.
When CSX took over Avon Yard after the Conrail break-up, CSX started running trains between Evansville and Avon using crews that were qualified between Evansville and Terre Haute, but not between Terre Haute and Avon. Those crews got former Conrail pilots until they were qualified.