The similarity and relationship between the Code of Hammurabi and the Torah have been noted by many. Some responses:
R' J.H. Hertz (summarized):
R' Hertz shows that the more we know about The Code of Hammurabi, the more we can appreciate the Torah's laws in Mishpatim. The areas that our codes differ shed light on the beauty and majesty of Torah. ... One general area of law that is ignored by Hammurabi and is a focal point of the Torah is how to treat the poor and needy with consideration and assistance. These examples show that the Torah is spiritually elevated above The Code of Hammurabi and this speaks to a Divine Author.
Most of the social and economic and political laws of the Torah fall into the category of what we call mishpatim – rules that can be derived by logic... Accordingly, it is not so surprising that Hammurabi came to similar conclusions that are stated in the Torah.
Furthermore, G-d gave laws of social and economic conduct to Noah (who preceded Hammurabi) and this was the original code of law that man was given. It can probably be shown that Hammurabi's code is merely a derivation from this earlier source. 
From the Virtual Beit Midrash:
It is reasonable to assume that the Torah wished to retain the laws of the ancient nations, as long as they did not involve injustice or heresy. When those laws had a moral foundation, the Torah did not want to deviate from them in any significant manner, in order that the Jewish people more readily accept them. Rabbi Avraham Yitzchak Kook (Eder ha-Yakar, p. 42) bases his position on that of Rambam.
Rav Kook accounts for the similarity between the laws of the Torah and those found in the ancient Near Eastern codes, by pointing to the truth and justice embodied in those codes, as well as to the social-educational factor that would not allow for any significant deviation from them.
In recent generations, rabbinic authorities as well as academicians have argued that along with the recognition of the similarity between the Torah and ancient Near Eastern law, note should be taken of the differences between them. It is precisely the similarity between the two that often highlights the points at which the Torah deviates from its ancient parallels. Reflecting upon these points can be highly instructive regarding the values underlying the laws of the Torah.
It is precisely the comparisons that we have drawn between the Torah and the various legal codes of the ancient Near East that strengthen our recognition of the moral intensity and uniqueness of the Torah.
For a more detailed explanation, including examples, please see: