According to the Midrash (Esther Rabbah 6:8), Mordechai had two purposes in visiting Esther. One was to answer her questions about whether she was considered a niddah, woman having her monthly period. One of the lessons from this is that we must always make the best of our situations. No, Esther’s situation was not ideal, but even there – in the king’s harem – she cared about maintaining her spiritual state.
Mordechai’s other reason listed in the Midrash (ibid.) was to make sure Esther was not the victim of witchcraft from the other women in the harem, who were seemingly desperate to become the future queen. If they were so desperate to avoid marrying Achashverosh earlier, why would they now perform witchcraft to accomplish just that? Perhaps living in a harem for the rest of their lives was that much worse a fate. Perhaps this is what the Ibn Ezra and Vilna Gaon mean when they say Mordechai visited Esther to heal her. As great as he was, he may have possessed power to remove the effects of any curses placed on Esther.
Alshich says Mordechai was concerned that Esther, being a descendant of King Shaul, was going through this tragedy to make up for Shaul’s sin of letting Agag – and thus Amalek – survive.
Rav Moshe Meir Weiss takes Mordechai’s checking on his wife every single day without fail, as a lesson for all husbands. He mentions that one of his congregants asked him once to daven for the congregant’s wife while she was having a procedure because the husband would be at work at that time, and unable to be in shul. Rav Weiss responded, “How can you be going to work if your wife is going to the doctor?!” That is a reason to take the day off.