In December 1835, Salomons was elected as an Alderman of the City of London, but again faced an unacceptable oath, and on this occasion the law was not changed. Salomons was disqualified, but was re-elected in 1847, after the Religious Opinions Relief Act had amended the oath. In 1855, the Aldermen elected him as Lord Mayor of London.
In the meantime, he trained as a lawyer and was called to the bar in 1849, though he did not practise as a barrister. However, he was the first Jewish magistrate in England. In 1847 he served on the committee of the British Relief Association.
He was not permitted to serve in the House of Commons, because he had not taken the oath of abjuration in the form established by Parliament. However, he did not withdraw quietly: instead he took the oath, but omitted the Christian phrases, and took his seat on the government benches.
He was asked to withdraw, and did so on the second request, but he returned three days later, on 21 July 1851. In the debate that followed, Salomons defended his presence on grounds of having been elected by a large majority, but was eventually removed by the Sergeant-at-Arms, and fined £500 for having voted illegally in three divisions of the House. He failed to win re-election in the 1852 general election.
When the law was eventually changed in 1858, Lionel de Rothschild became the first Jewish MP to legally take his seat, having been elected in 1857. In the 1859 general election, David Salomons was re-elected for Greenwich and served as the constituency's MP until his death in 1873.
His country house Broomhill north of Tunbridge Wells is now preserved as the Salomons Museum.
He died on 18 July 1873, and is buried in the Jewish Cemetery at West Ham. He had no children by either of his marriages, so his estate and titles passed to his nephew David Lionel Salomons, whom he had brought up after the death of Sir David's brother Philip Salomons.