This verse teaches us the mitzvah of kiddushin—that a man must betroth his wife before they begin living together as a married couple. In the words of the Rambam:
Once the Torah was given, the Jews were commanded that when a man desires to marry a woman, he must acquire her as a wife in the presence of witnesses, and only then does she become his wife. This is stated in the verse “When a man takes a wife.”
The effect of the kiddushin is twofold: it designates the woman to be married to this man, and simultaneously “prohibits her to the rest of the world.”
The relationship between G‑d and the Jewish people, which is often compared to a marriage in the scriptures and teachings of Chazal, likewise contains both aspects of kiddushin. The first aspect of this kiddushin is to devotedly strive to cleave to Him; the second is to distance ourselves from anything that could distract us from this relationship—namely, mundane passions and desires. Just as both components of the kiddushin between man and woman are interdependent, and one cannot exist without the other, so is it with the kiddushin between G‑d and the Jewish people. In order for our love and attachment to G‑d to be complete, we must truly separate ourselves from any other lusts or passions. In the words of the Chovos HaLevavos, “It is impossible to implant love of G‑d in our hearts while love of this world still resides within us.”
—Likkutei Sichos, vol. 19, pp. 217–218