The sefer, Prashas Derachim, says that according to the Rishonim – who opine that Avraham had the status of a Yisrael – Avraham acted correctly by not transgressing.
The Nimukei Yosef (Sanhedrin 18a) says that although one may not give up his life for other mitzvos (aside from not practicing avodah zarah, murder, and arayos), if an adam gadol – a chassid and yirei shamayim – sees that the generation is parutz in a certain area he may give up his life for that particular cause so that his generation will learn from him.
Perhaps we can apply this to Avraham Avinu who, whether he had the status of a ben Noach and therefore should not have allowed himself to be killed for this aveirah or if he had the status of a Yisrael and attempted to kill himself, saw that the entire world was lacking in any knowledge of Hashem and therefore felt the need to make a statement in order to teach the world that there is a God. Hence he was permitted to go into the fire to pronounce to the world that there is a God.
For questions or comments, e-mail [email protected].