Dhanuson Dharmasena, 32, is accused of carrying out the illegal procedure at the Whittington Hospital in north London.
The doctor, of Ilford, London, denies the charge in what is the first prosecution of its kind in the UK.
A second man, Hasan Mohamed, 41, denies encouraging and abetting the offence.
Female genital mutilation, often abbreviated to FGM and also known as female circumcision, involves procedures that include the partial or total removal of the external female genital organs for cultural or other non-medical reasons.
It is practised in 29 countries in Africa and some countries in Asia and the Middle East, but is illegal in the UK.
Carrying out female genital mutilation carries a maximum sentence of 14 years in prison.
The mother-of-two, who cannot be identified, first underwent FGM aged six in Somalia, London's Southwark Crown Court heard.
She was 24 and living in Britain when she give birth to her first child in November 2012.
The court heard that during labour, her FGM stitches were torn and Dr Dharmasena, a junior registrar in obstetrics and gynaecology, sewed her back up in a procedure that amounted to FGM.
The prosecution alleges the doctor did so at Mr Mohamed's "insistence or encouragement".
Kate Bex, prosecuting, told jurors that FGM was "very dangerous for a woman's health and psychological well-being".
"It can lead to severe health problems and, in some cases, to death. FGM causes gynaecological, urological and obstetric problems in women, chronic pain and sexual dysfunction," she said.
"It increases the risk of death in childbirth to both mother and baby."
Jurors heard the woman would have been most exposed to these side-effects when the surgery was first performed when she was six.
Dr Dharmasena's stitches would not have carried the same risks, but should not have been sewn at all "unless medically necessary", Ms Bex said.
The hospital trust launched an investigation into the incident within a few weeks.
In a statement, Dr Dharmasena said he had carried out the procedure because he thought the woman wanted him to. He also said Mr Mohamed had urged him to do so.
He said: "At no point in time did I intentionally or deliberately want to cause any harm to the patient. I had obeyed all of the patient's wishes."
But jurors were told he had changed his justification when he was interviewed by police in August 2013.
Ms Bex said: "It would seem that Dr Dharmasena had familiarised himself with the law and you may feel that he changed tack as a result."
Ten months after the operation, he raised the possibility that it had been "medically justified", she told the court.
Dr Dharmasena denies one count of female genital mutilation.
Mr Mohamed denies one count of aiding or abetting the procedure, and one count of intentionally encouraging or assisting the commission of an offence.
The trial continues.