"Shut up" is a direct command with a meaning very similar to "be quiet"', but which is commonly perceived as a more forceful command to stop making noise or otherwise communicating, such as talking. The phrase is probably a shortened form of "shut up your mouth" or "shut your mouth up". Its use is generally considered rude and impolite, and may also considered a form of profanity by some.
Before the twentieth century, the phrase "shut up" was rarely used as an imperative, and had a different meaning altogether. To say that someone was "shut up" meant that they were locked up, quarantined, or held prisoner. For example, several passages in the King James Version of the Bible instruct that if a priest determines that a person shows certain symptoms of illness, "then the priest shall shut up him that hath the plague of the scall seven days". This meaning was also used in the sense of closing something, such as a business, and it is also from this use that the longer phrase "shut up your mouth" likely originated.
One source has indicated this:
The use of the phrase "shut up" to signify "hold one's tongue" or "compel silence" dates from the sixteenth century. Among the texts that include examples of the phrase "shut up" in this context are Shakespeare's King Lear, Dickens's Little Dorrit, and Kipling's Barrack-Room Ballads.
However, Shakespeare's use of the phrase in King Lear is limited to a reference to the shutting of doors at the end of Scene II, with the characters of Regan and Cornwall both advising the King, "Shut up your doors". The earlier meaning of the phrase, to close something, is widely used in Little Dorrit, but is used in one instance in a manner which foreshadows the modern usage:
'Altro, altro! Not Ri-' Before John Baptist could finish the name, his comrade had got his hand under his chin and fiercely shut up his mouth.
In another instance in that work, the phrase "shut it up" is used to indicate the resolution of a matter: