She was an able exponent of Dharma. During the span of life -- which at that time was reputedly 10,000 years -- she rendered signal services to the Dispensation by spreading the Dharma far and wide. Thereafter to two of the buddhas in succession, Kakusanda and Konganna, having been born to wealthy families, she was able to offer shelter to the buddhas, acquiring much merit in the process. Thereafter, in the Dispensation of Buddha Kassapa, she was born as the daughter of Kiki, the King of Benares, and her name was Samsari. She listened to that buddha so ardently that she built and donated a magnificient monastery to him.
In the Dispensation of Gautama the Buddha, she was born in a princely family in Sagala with the name Khema. The color of her complexion was golden. She was exceedingly beautiful and married King Bimbisara of Kosala. She was reluctant, however, to visit Shakyamuni Buddha for fear that the Blessed One would condemn the “fleeting nature” of beauty.
Every time she visited the temple, she dodged meeting the Buddha. One day the king ordered his men to take her to the Buddha. On her arrival, the Buddha used his siddhi-powers to create a female attendant of unsurpassed beauty. Khema was struck by her beauty. While Khema was thus enthralled, she felt that beauty could only beguile. Knowing Khema's mind, the Buddha then made the figure rapidly pass from youth through middle age, old age, and extreme old age devoid of all beauty.
To a mind thus prepared and ready to receive the liberating truth, the Buddha preached. The seeds of the Dharma fell on good ground. For Khema became a stream-enterer (sotapanna), the first stage of liberation.
She asked the king, her husband, for permission to ordain as a Buddhist nun. The king, himself a noble disciple of the Buddha (at least a stream-enterer), readily consented.
One day sometime later, Mara Deva (supernaturally adopting the guise of a handsome young man) tempted Khema. He was utterly rebuffed. Undone, he took flight. One night soon after, Khema thought of visiting the Buddha. But at that time the Buddha was with Sakka, chief of the dieties in his realm. Rather than disturb the Buddha, Khema wheeled around in the air and disappeared. Sakka on seeing this remarkable display was soon apprised of its meaning by the Buddha. And addressing the monastic and lay disciples, the Buddha declared Khema "foremost in wisdom" among all his female disciples.
Fair maid lost in thy beauty
Was rescued by the Great Sage
Thy mind as keen as razor's edge
Thou heard the call of Duty
Those smitten with passion
into a self-made stream,
like a spider snared in its own web.
But having cut it, the enlightened set forth,
free of longing, abandoning
all suffering and stress (Dhp. 347)