To me, that law is talking about a Jew's voluntary choice to marry someone outside the Jewish faith and ethnicity - marrying someone that God specifically said not to.
I don't see Esther as having a choice.
Esther did not seek to be queen and was "rounded up" and put into a harem that was required to undergo beauty treatments for a year before the King - a very pagan man - came and declared which one was the most alluring to him. And besides that, he took each one of them for nighttime "test run" before he made his final decision. The Bible says if he enjoyed their "company", he might bring them back to his bedroom.
Mordecai, Esther's cousin in charge of raising her, was worried sick about her and would pace up and down in front of the harem's quarters wanting to know how she was doing. He told her not to reveal her ethnicity because no matter how beautiful she was - the King would reject her.
I see this story as Esther finding herself the queen outside of her control and Mordecai's control and finding herself born for that moment.
God used all kinds of people in all kinds of strange and abhorrent situations and used them for his glory's sake.
I don't think she violates that law.