Many things have the potential to be distracting. One is wearing headphones. For one, it limits what a person can hear. Also, whatever a person is listening to through their headphones might be mentally distracting to them. So, wearing headphones is among the things it can be dangerous to do when driving.
Is it against the law to wear headphones while driving? It depends on the state a person is driving in. States vary in what particular kinds of driver activities they regulate. Currently, less than half of the states directly regulate driver headphone use.
However, Maryland is one of the states that has a ban on certain types of driver headphone use. So, a Maryland driver could face a fine if they have headphones on when driving. An important thing to note though is that whether a driver wearing headphones would be considered in violation of this Maryland law depends on whether they have both ears covered or just one. Maryland's ban only prohibits driving while having both ears covered by headphones.
Of course, having just one ear covered by a headphone still could be a dangerous distraction for a driver. It is also worth noting that a driver's conduct doesn't have to be illegal to be considered negligent for the purposes of liability. When a person is hurt in a car accident and believes that one of the drivers involved had one or both ears covered by headphones at the time of the crash, skilled attorneys can give them guidance on what grounds they may have for legal action regarding the accident.
Source: WTOP, "Even wireless headphones don't have place behind the wheel," Dick Uliano, Sept. 13, 2016