I have no idea what you mean by that. Were there or were there not codes of morals and ethics throughout the world pre-dating Islam? Homer's "mindset" hardly accounts for the majority of cultural or religious thinking in the world before Christ.
Laws can exist without an underlying ethic.
Oh? How does that work? What purpose would laws have without an underlying code of ethics?
As far as I can see most peoples around the world very much had a pre-ethical mindset in pre-Christian times, with just a few exceptions - the later Hindus, the Buddhists, to a degree the ancient Persians, etc.
Otherwise the Gods were worshipped and sacrificed to for purely utilitarian reasons, for the sake of personal and communal well-being in this world. There was no concept of salvation, or of good and evil as universal and objective and not particular or subjective concepts. One sacrificed and followed the rituals such that the rains would fall and the crops would grow as desired, for good fortune and for the confounding of ones enemies.
Laws that are intended merely to establish order and prevent conflict do not require an ethical foundation. A ruler can decree such laws merely as a convenience to himself for instance, such that he is freed from the need to judge, or to permit delegation of authority.