The UN's top court has unanimously ordered Israel to enable the unhindered flow of aid into Gaza in order to avert a famine.