Things to check
go to system preferences.sound/ output see if you can select built in speakers, make sure the volume is up mute box is not checked
try plugging a set of headphones in and out several times (there is a micro switch that sometimes gets stuck)
go to applications/utilities/Audio MIDI set up output tan select built in there in the left, make volume is up and mute is not checked
Try a NVRAM/PRAM reset:
Power off, power back on holding COMMAND OPTION P R continue to hold these keys till you hear the start chime 2 times then release, reboot.
If still no joy take it back for another machine or a refund.