[MENTION=121120]Valefors[/MENTION]
There are many theories on how ship-girls came to be
The darker more serious theory is girls, who have the compatibility to become a ship-girl can be modified into one, but in place your memories, humanity will have a clean slate. The situation with the enemy was so severe that the last compatible girl, the Emperor's own daughter became one.
As for the theory I liked best was the Abyssals (The enemies) were created from the hatred, malevolence and dark emotions of sunk ships. They've murdered countless people on ships and nearly wiped out the navy. In the darkest hour, ship-girls appeared. Ship-girls are thought to be the manifestation of the positives of sunken ships such as : hope, dedication, courage, etc.