Four of the constituent states of the United States officially designate themselves Commonwealths: Kentucky, Massachusetts, Pennsylvania, and Virginia. This designation, which has no constitutional impact, emphasizes that they have a "government based on the common consent of the people" as opposed to one legitimized through their earlier Royal Colony status that was derived from the King of Great Britain. The word commonwealth in this context refers to the common "wealth" or welfare of the public and is an older term for "republic" (cf. the 17th century Commonwealth of England).
In 1785, residents of Kentucky County began petitioning the Commonwealth of Virginia legislature for statehood. They wished the County to be recognized as a "free and independent state, to be known by the name of the Commonwealth of Kentucky." On June 1, 1792, Kentucky County officially became a state. The Constitution was changed as to the style for "all process and mandates" to "Commonwealth of Kentucky" in 1850; prior to that change "State of Kentucky" was used.
Kentucky is the only state outside of the first thirteen that uses "Commonwealth" in its name.
Massachusetts is officially named "The Commonwealth of Massachusetts" by its constitution. The name "State of Massachusetts Bay" was used in all acts and resolves up to 1780 and the first draft of the constitution. The current name can be traced to the second draft of the state constitution, which was written by John Adams and ratified in 1780.
The Seal of Pennsylvania does not use the term, but legal processes are in the name of the Commonwealth and it is a traditional official designation used in referring to the state. In 1776, Pennsylvania's first state constitution referred to it as both "Commonwealth" and "State", a pattern of usage that was perpetuated in the constitutions of 1790, 1838, 1874 and 1968. 
A detailed history describing the origins of Pennsylvania's government, including its designation as a commonwealth from colonial times, is available from the Secretary of the Commonwealth's office.
The name "Commonwealth of Virginia" dates back to its independence from the Kingdom of Great Britain. Virginia's first constitution (adopted on June 29, 1776) directed that "Commissions and Grants shall run, In the Name of the commonwealth of Virginia, and bear taste by the Governor with the Seal of the Commonwealth annexed." The Secretary of the Commonwealth still issues commissions in this manner. Among other references, the constitution furthermore dictated that criminal indictments were to conclude "against the peace and dignity of the Commonwealth." Additionally, the official title of the elected local prosecutor in each of Virginia's political subdivisions is the "Commonwealth's Attorney," as opposed to State's Attorney in other States or the more standard District Attorney.
In Virginia, the term State is now officially used, but usually in a compound structure rather than as a stand-alone noun. This is evident in the name of the agency "Virginia State Corporation Commission" and in "Virginia State Police".