When Esther decides to try to prevent the massacre of the Jewish people, she charges Mordecai to assemble all the Jews and fast on her behalf for three days. According to the Talmud, Esther’s original three-day fast was over Pesach. Pesach, however, isn’t a good time to hold a fast, for obvious reasons. Instead most Jewish communities instituted a one-day fast right before Purim.
Maimonides does not associate this fast with Esther and states that it is in memory of the fasts Jews observed in the time of Haman. However, Rashi and Rabbenu Tam both refer to the thirteenth of Adar as Ta’anit Esther.
While Rashi classes the fast as a custom and not a law, his grandson Rabeinu Tam views it as a rabbinic law. One of the benefits of the fast of Esther according to Rabbi Yosef Caro, is to insert a bit of sobriety into the riotous Purim festivities.