The desire for marriage has evolved because those who felt the desire had more descendants than those who did not. In evolutionary terms, a solid family unit is in the interests of both genders. It is simply a very good structure for the raising of children.
While it may seem that a male will produce more offspring by being foot-loose-and-fancy-free, this is compromised by the fact that women would prefer to have a man help raise the children (because then she can have more of them herself). The children themselves are far more likely to survive, and be successful reproducers themselves if raised with the assistance of a father.