It is to attract the men when they are in danger. Given our current way or life it is often a fairly vestigial mechanism which is simply irritating (indeed it is irritating for the same reason, likewise with a baby's cry). However it is still used from time to time.
I once saw a documentary where a teenage female chimpanzee was chased up a tree by one of the adult males (he wanted some of dat ass), she climbed up to the weaker branches that couldn't support his weight (because she was so light and dainty and he was so ripped). Then when she got there all she could do was scream and hope that help would come. And then the alpha male heard the screams and came running over and owned the rapist chimp.
Given that women would hang around the camp all day and look after the children/cook/clean etc, and the men would be far away hunting, the women more likely to survive were the ones who, when in danger, were able to attract the men of the camp faster. So as it has been said already, evolution is the reason for the high pitched scream when danger is around us. Back then danger would involve things that can be controlled, for example a bear coming into camp. This can be controlled by killing/chasing away the bear. Yet today we are subject to things such as plane crashes which are beyond the control of the passengers, but as it is still danger, women will still scream, even though nobody can save them.
People are talking about the male equivalent being the roar.
I don't think so. I've never heard a man 'roar' when in danger. I've only ever heard males do something like that when in pain. Generally when men find themselves in danger they tend to shout out of help by name if known, or if not then shouting 'help' will suffice.