The only thing that makes long-distance driving tolerable is music and/or podcasts. Unfortunately, using the car stereo isn't always an option. Perhaps the speakers are busted, or maybe your passengers hate your taste in music. In these situations, the obvious solution is to don a pair headphones. But is this actually legal?
The short answer is yes. Wearing headphones while driving is technically legal as there are no laws specifically prohibiting their use while driving.
However, in the event of an accident, police will carefully consider the factors that contributed to the crash. This will include potential driving distractions, such as headphone use.
In NSW this would fall under Road Rule 297(1), which states:
A driver must not drive a vehicle unless the driver has proper control of the vehicle.
"Proper control" is a highly subjective phrase. If a highway patrolman decides your noisy headphones are compromising your ability to drive, they can fine you under the aforementioned road rule.
In fact, you don't even need to be involved in an accident for this to happen. (For example, you can expect to receive an infringement if your headphones drown out a police car's siren and you fail to respond as a result.)
In conclusion, wearing headphones isn't going to get your fined or arrested by itself. But if the police pull you over for any reason, it is strongly advised that you remove them before they approach your car. Better safe than sorry.