The modern sense developed during the 17th and 18th centuries out of a much more general meaning of "common, public, general", which has been in English since the Middle Ages. The Bastard talks about the men of Angiers being left "naked as the vulgar air" (King John, II.i.387). And when a Gentleman talks about an impending battle as "Most sure and vulgar" (King Lear, IV.vi.120), he means it is "generally known" - it is definitely going to happen.
There is hardly any room for misunderstanding in such cases; but there are potential ambiguities when Balthasar talks about making "a vulgar comment"
(The Comedy of Errors, III.i.100). Similarly, when Suffolk says he would "rather let my head Stoop to the block ... Than stand uncovered to the vulgar groom", he means "low-born" or "humble" (Henry VI Part 2, IV.i.130).
And when Polonius tells Laertes, "Be thou familiar, but by no means vulgar" (Hamlet, I.iii.61), he is not advising him to avoid dirty jokes, but not to be plebeian, all things to all men.