"for a longer time" is correct; "in a longer time" is not.
The reason is because what you are describing is the duration of the travel to the workplace. "For _____" is generally how durations of time are described. For example: "I traveled for an hour to work." or "The United States has been a country for centuries."
The same applies if the duration is instead a comparison between lengths of time: "She traveled for a longer time than I did." or "England has been a country for a longer time than the United States."