The question is quite old now, but issue still remains on latest macOS (former OSX) version 10.12.4 Beta (16E163f).
One day I was using the headphones and the next day headphones jack port stopped working.
- Settings -> Sound -> "Use audio port for: Sound output"
- Select headphones instead of any other thing on "device for
- Reset NVRAM (previous PRAM)
- Reset SMC
Nothing worked, then I tried to reboot with headphones plugged in, kind of worked, but if you unplug the headphones after rebooting, and then plug back in, it's not working anymore (it's kind of a workaround).
>> Shut Down -> Start MacBook and press
CMD+R (Recovery Mode) -> Disk utility -> Select boot disk -> "First Aid" (both on the disk and the on the partition, did it also for the "Recover Disk Image", not sure if it helps) -> Reboot.
So far it's working fine.
Hope it solves your problem.
P.S.:What I was going to try next (not sure if it's possible) was to update/force reinstall audio drivers.
It stopped working, and looks like it's not possible to reinstall audio drivers)
Workaround: Without the need to reboot or anything, just: plug headphones in -> close the lid (sleep) -> open the lid (wake)
Sound should now be coming out through the headphones.