Onasanya was charged with perverting the course of justice in relation to two speeding incidents which occurred in 2017. The first charge alleged that she was driving the vehicle during a speeding incident on 24 July 2017 but that, with her brother Festus Onasanya, she had claimed that someone else was driving. The second charge concerned a speeding incident on 23 August 2017 when Festus is alleged to have been the one driving.
Her brother was charged with three counts, two relating to the same incidents as his sister. She appeared at Westminster Magistrates' Court on 12 July 2018. Onasanya said on 27 July 2018 that she "strongly refutes any suggestions that I have broken the law". On 13 August 2018 at the Old Bailey, she pleaded not guilty to the one charge against her, relating to an alleged offence in Thorney, Cambridgeshire, in July 2017. Her trial date was set for 12 November 2018.
A week before he was due to face trial with his sister, Festus Onasanya admitted three counts of perverting the course of justice. At the first trial, Onasanya said she did not know who was driving on 24 July 2017. She said that she initially mistakenly assumed that she could not have been driving the car on 24 July 2017 due to political commitments and left a Notice of Intended Prosecution (NIP) to be dealt with by whoever had been driving. Her brother, she said, had probably returned the form claiming someone else had been driving.
She said she now realised that she had had an appointment that would be consistent with her having been the driver but could not remember whether she had kept the appointment. On 26 November 2018, the jury was discharged as it was unable to reach a verdict.
At a retrial in December 2018, she was unanimously found guilty of perverting the course of justice. Following the verdict, she was immediately suspended from the Labour Party, which also called on her to resign as an MP. She was expelled from the party the following day. Her local newspaper, the Peterborough Telegraph, also called on her to resign.
Onasanya continued to protest her innocence, saying in a message to other Labour MPs that she was "in good biblical company along with Joseph, Moses, Daniel and his three Hebrew friends who were each found guilty by the courts of their day", and that "Christ ... was accused and convicted by the courts of his day and yet this was not his end but rather the beginning of the next chapter in his story". A week later, she indicated that she would not resign her seat. She applied to the Court of Appeal for permission to appeal against the conviction.
On 29 January 2019, Onasanya was sentenced to three months' imprisonment, and her brother was sentenced to ten months. As she received a custodial sentence, but of less than 12 months, a recall petition would be started after the appeal process had concluded. The local Labour Party said it would "actively" campaign in favour of such a petition. (A custodial sentence of more than a year, including a suspended one, would have led to her being removed as an MP automatically, in accordance with the Representation of the People Act 1981.)
In a statement on 31 January, the Attorney General's Office said it had received a request for the case to be considered under the unduly lenient sentence scheme, but on 25 February, it concluded that the sentence was not unduly lenient. Onasanya was released on home detention curfew from HM Prison Bronzefield in Surrey on 26 February. Her ability fully to participate in Parliamentary business depended on the terms of her curfew.
On 5 March 2019, her application for permission to appeal against the conviction was refused by the Court of Appeal. Onasanya presented without legal counsel, legal binders or notes, and the court found "absolutely no basis" for challenging the conviction.
In August 2019 a disciplinary tribunal of the Solicitors Regulation Authority struck Onasanya from the roll of solicitors and ordered her to pay costs of £6,562, after finding that she had "failed to act with integrity", had not "(upheld) the rule of law and proper administration of justice" and had "acted dishonestly".
In June 2020, Onasanya attracted national and international attention by accusing Kellogg's of racism for using a monkey as the mascot of their Coco Pops cereal.