(covers information from several alternate timelines)
USS was an identifying prefix used before the names of sea-faring ships on Earth and space-faring ships of United Earth and United Federation of Planets. The abbreviation has been used to stand for "United States Ship", "United Space Ship", and "United Star Ship".
As shorthand for "United States Ship," the US Navy used the USS prefix on the hulls of various sea warships, such as aircraft carriers and ironclads, including: USS Enterprise (CV-6), USS Enterprise (CVN-65), and USS Monitor. (ENT: "Storm Front"; Star Trek IV: The Voyage Home; TOS: "The Cage")
According to Porter, a so-called "patriot", after viewing the name "USS Voyager" on the stealth plane that crashed on his property in Arizona, ""U.S.S." equals Federal government. The Federal government is the Beast." (VOY: "Future's End, Part II")
Starfleet used the "USS" designation on certain computer graphics for United Earth NX-class starships, such as Enterprise NX-01 and Columbia NX-02. However, they did not label the hulls of the starships, and the ships were not commonly addressed with the prefix. (ENT: "Divergence")
On Federation starships operated by Starfleet, the "USS" prefix was more prominently featured on the hull of the ship and as part of the starship's official title. USS was referred to as standing for either "United Space Ship" (TOS: "The Cage", "The Menagerie, Part I", "Space Seed", "The Gamesters of Triskelion", "Patterns of Force", "Assignment: Earth", "Elaan of Troyius") or "United Star Ship." (TOS: "The Squire of Gothos", "Court Martial") This designation was used as early as 2167 on a Daedalus-class starship, the USS Essex. (TNG: "Power Play")
In his original March 1964 Star Trek pitch (p. 3), Gene Roddenberry utilized the prefix "S.S." for his then-envisioned primary space vessel, Yorktown. While the abbreviation has a real world maritime counterpart signifying "Single-screw Steamship", Roddenberry refrained on that occasion from specifying the abbreviation, but it stands to reason he either assumed "Spaceship" or "Starship", as hereafter indicated.
It was only after the series' pilot episode "The Cage" was picked up, and Roddenberry had worked out his initial pitch into the more fully worked out first version of The Star Trek guide internal document – famed in later Star Trek-lore under its "The Writer's Bible" denominator – that he amended the "S.S." to "U.S.S.", this time emphatically specifying the abbreviation to stand for "United Spaceship", and most certainly not for "United States Spaceship", as the old notion of traditional statehood had been abandoned in his vision of the future. (3rd revision, 17 April 1967, p. 1) Author Stephen Whitfield has related in his reference book The Making of Star Trek (p. 112) how Roddenberry had to actually mount a vigorous defense of the meaning of his new amended prefix against chauvinistic NBC network executives who were lamenting why it could not be "a good, safe patriotic United States spaceship."
The first spaceship from Earth known to use "USS" was first shown in Star Trek: The Motion Picture, in a picture of the USS Enterprise (XCV 330) on display on the recreation deck of the refitted USS Enterprise (NCC-1701). The placement of a desktop model of this craft in Star Trek Into Darkness suggests that the ship predates United Earth, so the USS designation may have still meant "United States Ship" at that point in history.
Shortly before Star Trek: Enterprise began its initial airing, Rick Berman implied that Enterprise NX-01 was purposefully without the "USS" prefix because it wasn't a Federation starship. (Star Trek: Communicator issue 134, p. 13) The use of "USS" by Starfleet before the formation of the Federation was only seen on a computer graphic in the Enterprise episode "Divergence". This graphic had both the Enterprise and the Columbia designated with the USS prefix, which may have been a mistake on the part of the graphics designers, as neither ships' hull designation used "USS".
At a later point in time and in regard to the original prefix "SS", Gregory Jein, Inc. model builder Bruce MacRae and co-builder of the SS Vico studio model, has postulated the "SS" prefix to stand for "Survey Ship", a designation that actually fitted the "job description" of most such endowed vessels featured in the Star Trek live-action productions.