The celebration derived from the story of Savitri and Satyavan. It has been foretold that Satyavan won't live long. Resting on the lap of Savitri, Satyavan was waiting for death under a banyan tree, when the day of death comes. The messenger of Yama, the God of death came to take Satyavan. But Savitri refused to give her beloved husband. Messenger after messenger tried to take Satyavan away, but in vain. Finally, Yama himself appeared in front of Savitri and insisted to give her husband.
Since, she was still adamant, he offered her a boon. She asked for the well being of her in-laws. He granted it to her. She then followed him as he took Satyavan's body away. He offered her another boon. She now asked for the well being of her parents. This boon, too, was granted. But she was relentless, and continued to follow him. As they approached Yama'sabode, he offered her a final boon. She asked for a son. He granted it. She then asked him how it would be possible for her to beget sons without her husband. Yama was trapped and had to return her husband.
So, married women pray to the banyan tree for the long life of their husbands and children. Their fast is observed the whole night till the next morning.