If a man marries a wife… (Deuteronomy 22:13)
There is an obligation for a man to marry a woman through one of three manners: by giving her money or an object of value, through a document of marriage, or by intercourse with the intention of marriage. In our modern marriage ceremonies, we effect marriage by giving the bride a ring, which is an object of value. The kesubah (marriage contract) does not effect marriage. (The couple does not actually have relations in the yichud room, though they presumably could.)
The obligation to marry is to the exclusion of having pre-marital or extra-marital relations. We see this in the blessing at a wedding, where the groom recites that God has forbidden such relations outside the context of marriage.
The purpose of this mitzvah is to unite a man and a woman in a common bond. The man should not treat the woman like a one-night stand, nor should she run around frivolously with other men. The bonds of marriage form a partnership with a certain exclusivity.
A woman cannot be wed against her will but if a man is compelled – a “shotgun wedding,” as it were – the marriage is valid and binding.
This mitzvah applies in all times and places. It is discussed in the Talmud in the first chapter of tractate Kiddushin. It is codified in the Shulchan Aruch in Even Ha’Ezer 26. This mitzvah is #213 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos and #44 of the 77 positive mitzvos that can be fulfilled today as listed in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.