Great question! To begin with, let's just quickly go over 'what Shakespeare was getting at'. This line is pretty frequently over-interpreted so that it is taken to mean that it is obliquely suggesting a lawyer's position in society is integral to upholding the peace. Our ragamuffin crew are talking about staging a revolution, and some have taken Dick the Butcher's line to suggest that one of the things standing in the way of their proposed revolution is lawyers, thereby praising their role as protecting citizens from upheaval. This is pretty unlikely, given that Shakespeare was as keen as the next person on a good old fashioned lawyer joke.
Characterising lawyers as tedious, money-grabbing, pedantic, over-paid and favouring the demands of the rich over genuine justice is not even remotely new, and that appears to be what Shakespeare is doing here. To put the quotation in a bit more context, prior to the conversation about lawyers Jack Cade is talking up his suitability as ruler. He is claiming noble heritage, while Smith and Dick the Butcher snigger at him in asides to the audience:
Jack Cade. My father was a Mortimer,—
Dick the Butcher. [Aside] He was an honest man, and a good
bricklayer.
Jack Cade. My mother a Plantagenet,—
Dick the Butcher. [Aside] I knew her well; she was a midwife.
Jack Cade. My wife descended of the Lacies,—
Dick the Butcher. [Aside] She was, indeed, a pedler's daughter, and
sold many laces.
We then get the conversation about lawyers, as Jack describes the ideal society he will build:
Jack Cade. Be brave, then; for your captain is brave, and vows
reformation. There shall be in England seven
halfpenny loaves sold for a penny: the three-hooped
pot; shall have ten hoops and I will make it felony
to drink small beer: all the realm shall be in
common; and in Cheapside shall my palfrey go to
grass: and when I am king, as king I will be,—
All. God save your majesty!
Jack Cade. I thank you, good people: there shall be no money;
all shall eat and drink on my score; and I will
apparel them all in one livery, that they may agree
like brothers and worship me their lord.
Dick the Butcher. The first thing we do, let's kill all the lawyers.
Henry VI, Act 4, Sc 2.
The audience is already primed that Dick is playing for laughs. Presented with Jack's utopian ideal, Dick's first thought about the best way to enact a utopia is to kill all lawyers (badum-tish).
This kind of joke turns up elsewhere in Shakespeare's plays, and it is pretty reasonable to assume that 'let's kill all lawyers' is intended to be funny, not serious. Mercutio's 'Queen Mab' speech in Romeo and Juliet mentions 'lawyers' fingers, who straight dream on fees', and Act 1 Sc 4 of King Lear has Kent say 'this is nothing, Fool' only for the Fool to reply, 'Then ’tis like the breath of an unfee’d lawyer. You gave me nothing for ’t' (i.e. an unpaid lawyer won't say anything).
As for whether your average Elizabethan playgoer would get the joke - it seems pretty likely. These kinds of wisecracks about lawyers have cultural relevance outside of Shakespeare. My own area of research is focused on epitaphs, and I have found some contemporary examples of epitaphs copied into manuscripts making jokes at the expense of the legal profession. See for example:
Vpon Mister I. H. a Counsellor of Lincolnes Inne./
Here lyes a Lawyer, who till his tyme of dying
did gayne much mony by his vse of lying
Liuing he ly’d; and dead he lyes you see
within his graue, where let him lye for mee./
Cambridge University Library, Additional Manuscript 4138, f52r
'Occupational' epitaphs are a whole subgenre where the deceased is characterised by their profession (it includes one about a locksmith who picks the lock to heaven's gate rather than be let in, and a bellows mender who runs out of breath, for example). The avariciousness and untruthfulness of lawyers is seen by this writer as to be so characteristic that it is the best way to lampoon 'Mister I. H.' (whoever he may be!).
[EDIT: Thanks /u/chikindiner for pointing out that I had the wrong source here. It's now corrected.] Philip Stubbes' Anatomy of Abuses (1583) gives the following description of lawyers in a section entitled 'English Lawyers are Rogues', he writes,
[Lawyers] handle poore mens matters coldly, they execute iustice parcially, & they receiue bribes greedily, so that iustice is peruerted, the poore beggared, and many a good man iniured therby. They respect the persons, and not the causes; mony, not the poore; rewards, and not conscience. So that law is turned almost topsie turuie, and therefore happy is he that hath least to doe with them.
This type of commentary about lawyers was common enough to not only see print, but was common enough to be copied into personal manuscripts as a joke, and to be used as the foundation of a number of jokes on the Elizabethan stage. The line would likely have gotten a good chuckle out of the audience at the time.
Hope this answers your question, do let me know if you have any questions!
edit: formatting goof
edit again: Thanks so much for the gold, stranger. I love being part of this sub, and it's always so exciting to see other people enthused by this stuff. You've really made my evening :)
edit again again: Just woke up to double gold! Thank you so much, whoever you are, that's super kind :)
Follow up question could you also address what Shakespeare was getting at in the historical context?