After she emerges from the Churning of the Ocean, Lakshmi examines the Devas, Gandharvas, Asuras, etc., to find a suitable husband. But she finds that they're all lacking in one or more good qualities, as described in this chapter of the Srimad Bhagavatam:
Someone who has undergone great austerity has not yet conquered anger. Someone possesses knowledge, but he has not conquered material desires. Someone is a very great personality, but he cannot conquer lusty desires. Even a great personality depends on something else. How, then, can he be the supreme controller? Someone may possess full knowledge of religion but still not be kind to all living entities. In someone, whether human or demigod, there may be renunciation, but that is not the cause of liberation. Someone may possess great power and yet be unable to check the power of eternal time. Someone else may have renounced attachment to the material world, yet he cannot compare to the Supreme Personality of Godhead. Therefore, no one is completely freed from the influence of the material modes of nature. Someone may have longevity but not have auspiciousness or good behavior. Someone may have both auspiciousness and good behavior, but the duration of his life is not fixed. Although such demigods as Lord Śiva have eternal life, they have inauspicious habits like living in crematoriums. And even if others are well qualified in all respects, they are not devotees of the Supreme Personality of Godhead.
So rejecting everyone else, she chooses Vishnu, since he's the only one in possession of all auspicious qualities:
In this way, after full deliberation, the goddess of fortune accepted Mukunda as her husband because although He is independent and not in want of her, He possesses all transcendental qualities and mystic powers and is therefore the most desirable.Approaching the Supreme Personality of Godhead, the goddess of fortune placed upon His shoulders the garland of newly grown lotus flowers, which was surrounded by humming bumblebees searching for honey. Then, expecting to get a place on the bosom of the Lord, she remained standing by His side, her face smiling in shyness.
By the way, note that this is only the story of how Vyuha Vasudeva, the form of Vishnu who lies down in the ocean of milk, married the goddess Lakshmi who was born from the Churning of Vishnu. But Para Vasudeva, the eternal Vishnu who dwells in Paramapadam, is married to an eternal Lakshmi. (See my answer here for more information on these forms of Vishnu. Para Vasudeva has two other wives, Bhu Devi and Nila Devi whom I discuss here.)