Try an SMC reset:
Resetting the SMC (System Management Controller) on Intel-based Macs:
Resetting your Mac's PRAM and NVRAM:
If the afore mentioned by Klaus 1 does not solve the problem, look in the audio output port for a red light. If there is one visible, insert a phone jack a few times. If that fails, insert a tooth pick and jiggle it. If that fails have a repair facility do it.
There is a switch that you are trying to trip that will then send the audio to the internal speakers. A red light indicates that only ear phones will get the audio signal.