The phrase to swear like a trooper means: to use a lot of swearwords.
This phrase alludes to the fact that troopers (i.e., soldiers of low rank in the cavalry) had a reputation for coarse language and behaviour.
The phrase to swear like a trooper occurs, for example, in an interview of the Welsh actress Rakie Ayola (born 1968), by Nick Curtis, published in the Evening Standard (London, England) of Wednesday 22nd July 2020:
Born in London to a Sierra Leonean mother she barely knew and a Nigerian father she never met, she was informally adopted as a toddler by her mother’s cousin, a sailor, and his white wife, Olive—“peroxide blonde, 40 fags a day, swore like a trooper”—in Cardiff.
The earliest occurrences of the phrase to swear like a trooper that I have found are as follows, in chronological order:
1-: From a letter to Nestor Ironside, by the English essayist, poet, playwright and politician Joseph Addison (1672-1719), published in The Guardian (London, England) of Monday 7th September 1713—I had like to means I came close to:
I had like to have been knocked down by a shepherdess for having run my elbow a little inadvertently into one of her sides. She swore like a trooper, and threatened me with a very masculine voice.
2-: From A Discourse on the Miracles of our Saviour, in View of the Present Controversy between Infidels and Apostates (London: Printed for the Author, 1727), by the English religious writer Thomas Woolston (1670-1733):
Where’s the Absurdity to suppose, that the Disciples themselves might contrive the Intoxication of the Guards? Herodotus tells us a Story of a dead-Body’s being stolen away by such an Artifice. And I don’t think the Disciples of Jesus either so foolish or conscientious as not to take the Hint and enterprise the like Fraud. Peter, who upon occasion, could swear and curse like a Trooper, would hardly scruple to fuddle a few Foot-Soldiers.
3-: From The Devil to pay at St. James’s: Or, a full and true Account of a most horrid and bloody Battle between Madam Faustina and Madam Cuzzoni (London: Printed for A. Moore, 1727), by the Scottish mathematician, physician and satirist John Arbuthnot (1667-1735):
Senesino is disgusted to the last Degree to see himself neglected, and such a Bustle made about these two Madams; he curses the Directors, damns the Opera, sinks the Composers, and bids the Devil take the whole Town: He swears like a Trooper, and raves like a Madman.
4-: From Silvia; Or, The Country Burial. An Opera (Dublin: Printed by S. Powell, for George Risk, George Ewing, and William Smith, 1730), by the English playwright George Lillo (1691-1739):
G. Gab. I can’t but say she had an ugly way with her, of abusing every Body.
G. Cost. Ay, ay; we all know that she was the greatest Scold in the Parish.
G. Gab. And that she swore like a Trooper.
5-: From The Female Rake: Or, Modern Fine Lady. An Epistle from Libertina to Sylvia. In which is contain’d, The A-la-mode System, published in The Flowers of Parnassus: Or, The Lady’s Miscellany, for the Year M.DCC.XXXV (London: Printed and Sold by J. and T. Dormer, 1736):
Vesana is forbearing, just, and meek;
To the Necessitous a Friend:——No more
She counts herself, than Steward to the Poor:
Yet for a Trifle, will this Lamb grow warm,
And roar as loud as a November Storm;
Swear like a Trooper, ev’ry Servant beat,
Curse her own Children, and alarm a Street;
Prey on the Needy by usurious Loan,
And surely make their small Remains her own.
6-: From The Fortunate Country Maid. Being the Entertaining Memoirs of the Present Celebrated Marchioness of L. V. Who from a Cottage, through a great Variety of Diverting Adventures, became a Lady of the first Quality in the Court of France, by her steady Adherence to the Principles of Virtue and Honour (London: Printed for and sold by F. Needham, 1740), a translation of La Paysanne parvenue, ou les Mémoires de Madame la Marquise de L. V. (1735-8), by the French novelist Charles de Fieux (1701-1784):
The furious blind Man, provok’d at her Boldness, called her Names, struck her with his Cane, swearing like a Trooper, and threatening that if any one presum’d to come within his Reach, he would lay about him.
7-: From Pamela: Or, Virtue Rewarded. In a Series of Familiar Letters from a Beautiful Young Damsel, to her Parents (London: printed for C. Rivington; and J. Osborn, 1741), by the English author Samuel Richardson (1689-1761):
MONDAY, TUESDAY, WEDNESDAY, the 32d, 33d, and 34th Days of my Imprisonment.
NOTHING offers these Days but Squabblings between Mrs. Jewkes and me. She grows worse and worse to me. I vexed her Yesterday, because she talked nastily, and told her she talk’d more like a vile London Prostitute, than a Gentleman’s Housekeeper; and she cannot use me bad enough for it. Bless me! she curses and storms at me like a Trooper, and can hardly keep her Hands off me. You may believe she must talk sadly to make me say such harsh Words: Indeed it cannot be repeated; and she is a Disgrace to her Sex. And then she ridicules me, and laughs at my Notions of Honesty; and tells me, impudent Creature that she is! what a fine Bedfellow I shall make for my Master, (and such-like) with such whimsical Notions about me!—Do you think this is to be borne? And yet she talks worse than this, if possible!—Quite filthily! O what vile Hands am I put into!