An evolutionary reason for sex in public being worse than the alternative is not hard to find – you are exposed to attack while having sex, and therefore try to do it where you can’t “get caught”. While this is not the only explanation, it is sufficient.

Other reasons might be on a direct evolutionary level such as the one above, or might be more complex – our mind evolved in ways that made it susceptible to social pressure, and such pressure is not necessarily evolutionarily conducive – read more about memes if you want to know about that.

As for sex being an intimate act one does not do in public, etc., that is on a totally different level of explanation than the one sought by kaatunut, though it may be just as true.