During WW2, there were wage controls, but employers needed to attract workers, so Congress gave them this small (at the time) tax break for providing health insurance to workers. (They don't have to pay payroll taxes on that portion of compensation.) Who doesn't want to encourage employers to provide perks to their employees, especially perks that improve their health?
But this has blossomed into a huge market imbalance, where people can't change jobs due to insurance concerns, and buying individual insurance puts you at a huge financial disadvantage compared to employer-provided insurance.