According to Targum Sheini, Mordechai was concerned that the king would become upset with Esther at some point, and take his anger out on her people. This is similar to what actually happens when Haman becomes angry with one Jew, Mordechai, and decides to exterminate his entire people as a consequence (see below 3:6).
The Ibn Ezra quotes commentators critical of Mordechai for this order, saying his selfish intent was for Esther to not be chosen by Achashverosh, so that she could return to being Mordechai’s wife. He rejects these opinions, and comments that Esther’s keeping this secret allowed her to stay Jewish because the king would have used violence in an attempt to force Esther to convert had he known her background.
Rabbi Eliezer of Worms writes that Mordechai knew that Esther’s very presence in the harem of the king meant that she was placed there for a reason. After all, wherever we are in life, H-Shem wants us there for a reason, though we often do not readily know what it is.
Rav Moshe Meir Weiss adds that even if Esther did not understand the reason for her secrecy, or even if she disagreed, this verse is a praise to her for listening to the words of Mordechai, the Gadol HaDor (greatest rabbi of her generation). When we trust the Sages, things go well for us.