I must admit this is a very interesting question. You are right,
it seems there is no purpose of getting married when you can have both sex and kids without doing it.
There is a deep reason to get married, though. Let me elaborate:
The process of having a child is very simple: Man and woman have intercourse, a spermatozoid fertilizes and ovum and you wait nine months average for her pregnancy period to finish and give birth to a child.
Period? No.
As I once read on these articles called Women Unveiled ( http://www.singles-advice.com/how-to-understand-women.htm ) and To understand women ( http://www.heptagrama.com/en/i_vos_hym_0001.htm ), a woman's psychology needs security to unleash and develop completely.
Society and tradition has outlined marriage as the best way to achieve this, because in marriage both men and women promise each other life-time mutual assistance until death do them apart.
Let me repeat and emphasize:
Life-time mutual assistance... not a night, not a year.
Do we need this?
Taking into account that we are usually not very aware of how vulnerable both woman and baby become when there is a pregnancy, I would say yes.
To have a healthy baby, a mother needs to feel calm and safe. (Moreover, studies prove that stressed women usually give birth to children who later become very prone to illnesses.) It is important for her to receive that protection.
What about men? You might be asking yourself.
Maybe times have changed too much in the last century, but before, life was very harsh for us. I still think it is. The old "boys don't cry" motto can be a good proof of this.
Where could a man turn to unleash his tender, affectionate side? We usually do this with a woman, don't we? Well, how would you feel if you tell your deepest feelings to a woman and suddenly, she doesn't only laugh at you later, but she also tells everybody about your darkest deeds? You would feel very ashamed, wouldn't you? I would, for certain.
What if she has made a promise of life-time love and assistance with you? Would she betray you that way? I think she wouldn't. She has made a promise.
I think that, with this, you can understand the purpose of marriage better: A marriage is a man and a woman who get together and promise mutual assistance because they both know both that they will both need it and that they can trust each other strong enough to lay their own lives in their spouse's hands.
Tell me if trusting is not a better way to live a life than distrusting.
This takes me to the matter of divorce, the other part of your question. Why are there divorces?
Although I don't have an exact answer to any and all divorce cases, I have a theory that may be very useful: People divorce because they fail to get to know each other strongly enough to trust each other completely.
I remember what mum told me about it:
"Son", she said, "you know what's the secret of a good marriage?".
"What is it?", I asked.
"Do not get married when you are in love with a woman."
"Come again?"
She laughed and said:
"To marry a woman, son", she said, "you must not be in love with her. You must be totally, absolutely, brutally and radically sure that, not matter how you change with the years, and no matter how she changes with the years, you will still be able to love each other."
And later she added,
"You must be able to talk about everything with her, and I do mean everything, like a couple. Never forget that the two worst enemies of love are hunger and distrustfulness. Both of your lives must always walk in the same path, else, your love life will fall apart".
What about sex? Sex is just the glue that holds both of you together. It is the moment of deepest intimacy and love you can physically show to and receive from each other.
What happens these days, however? People get married because their lust made them bear an unwanted child. They get married because they don't have a good family environment and they want to run away. They get married because one of them has enough money 'for the rest of their lives'. They marry because anything but for what they should. That's why there are so many divorces.
It is pretty obvious I believe in marriage, isn't it?
What is the purpose of marriage, in short?
The purpose of marriage is to create a family. Maybe that word has lost its value in the last decades, but it is still the most valuable thing a person can have. If you don't agree, remember your own family... and, if you didn't have a family, remember how strongly you wished to have one.
Hope this helps.