Cdr Sarah West, 42, took charge of Type 23 frigate HMS Portland in May 2012, but left her vessel last month.
A Royal Navy spokesman said Cdr West had now been "removed from command" but gave no further details saying it was an "internal matter".
She would be reappointed to another post, the spokesman added.
Cdr West had been on board Plymouth-based HMS Portland on a deployment since January.
Last month, the Ministry of Defence confirmed it was "aware of an allegation of a breach of the code of social conduct" on board the ship, which it said it was "treating seriously".
The code governs personal relationships, which are not permitted if they compromise operational effectiveness.
Confirming her removal, a Royal Navy spokesman said the case was an "internal matter between the individual and her senior officers".
"Cdr West will continue to serve in the Royal Navy and she will be reappointed to a post where her skills and experience can be used to best effect," the spokesman added.
The spokesman said Cdr West's second-in-command had taken over the running of HMS Portland.
When she took up her post in May 2012, Cdr West said it was "definitely the highlight of my 16 years in the Royal Navy so far".
Cdr West, who grew up in Lincolnshire and joined the Royal Navy in 1995, previously commanded four minesweepers. There has been no confirmation that Cdr West had a relationship with a fellow officer.
The first female commander of a major Royal Navy warship has been removed from her post following allegations of an affair with one of her officers.