I have read a lot about Rosemary, some authors have also done excellent seminars on her, you can find them on YouTube if interested. Here's a summary of what is believed to have happened to Rosemary:
Rosemary was born at her parents' home. A midwife was present when her mother was in labor, apparently the unwritten rule at that time was for the midwife to keep the baby inside until the doctor arrived so that he could collect his delivery fees. It was 1918 when Rosemary was born, there was a flu pandemic and the doctor was overwhelmed with patients, it is believed that Rosemary was kept inside for too long which deprived her of oxygen, resulting in her being mentally challenged.
The Kennedys noticed that there was something off about Rosemary when she was a toddler. Through her grade school years, they tried everything to "cure her". Joe made sure that the entire family did everything in their power to shelter and protect her, and most importantly, hide her handicap from the rest of the world. For example, once she hit puberty, she would accompany the family to different functions, her brothers and their close friends would fill up Rosemary's dance cards, she was never allowed to socialize with males other than her brothers and other trusted family/friends.
Finally the Kennedys realized that there was no "fixing" Rosemary. They sent her away to exclusive private schools. Within days, the staff would notice that there was something wrong and that Rosemary functioned at about the mental capacity of a 4th grader. They did their best to work with her but would eventually give up and send her back home. She would then be sent to yet another unwitting school, rinse and repeat over and over. Rosemary would write heartbreaking letters to her father and mother, begging them to tell her what she did wrong, why she was being sent away.
As she got in to her late teens/early 20's, the Kennedys really did not want her around at all to tarnish their reputation. They came up with the idea to send Rosemary to camps where she would be a camp counselor. The camp staff of course realized that Rosemary needed more help than the kids she was supposed to be counseling. Though the camps really did not want her, the Kennedys paid well so they tried to deal with the situation as best as they could. It was around this time that Rosemary started sneaking out and meeting boys in the area. She was caught with several young men during this time. Joe was notified what was going on.
The Kennedys were strict Catholics. "Fixing" Rosemary with a tubal ligation to prevent pregnacy was not an option. The Kennedys were terrified that Rosemary's promiscuity would become known to the world and Joe was determined to stop it. So, the lobotomy.
There was no accident with the lobotomy. It is ludicrous to think that a lobotomy would have fixed her mentally challenged state, no doctor at that time really believed that. The lobotomy was performed on Rosemary to incapacitate her and make it impossible for her to continue with her promiscuity and embarrass the family. She was immediately sent to a home for invalids several states away and that is where she lived out the rest of her sad life.