Persia, Fifth Century BCE
The Book of Esther is set in exile. The Jews have already weathered some pretty tough and crazy Babylonian kings, but have endured long enough to see more kindly Persian rulers. However, the kindliness eventually runs out. The new king, Ahasuerus (probably Xerxes I) doesn't seem to be quite as sharp as his forebears (kings like Cyrus and Darius), so the Jewish people are put into a dicey position once again.
The setting of the book is in a foreign land under a foreign empire—just like in the Book of Daniel. Though, Esther itself was probably written a century or two afterward, when the Jews were still dealing with foreign rulers who could sometimes be quite hostile. Thus, the Book of Esther was the kind of book that could help Jews who were living outside of the Levant or who were living under Gentile kings to remain courageous and have faith in themselves and in their sense of identity. The book describes people who managed to remain Jewish (though Esther temporarily hid her identity) while dealing with a time and a place of intense adversity.