夏天is a noun, meaning exactly summer,避暑is a verb, literal translation is avoiding the heat.避 means avoid,暑means heat,another phrase,中暑means heatstroke.
as for your two Chinese sentences, the correct one is他和家人在山间避暑,which means he and his familiy are avoiding the heat in the mountains.