A lot of other currencies seem to have symbols specific only to themselves (€, £), so I have been wondering how it came to be that the dollar sign is common to so many different currencies worldwide. Off the top of my head, I can think of pesos, USD, CAD, and AUD.
(You often see a handwritten variant in the US where the $ has two vertical lines through it instead of one, but since I couldn't find any way to type it I guess that must not be correct.)
There are multiple stories on the actual origin of the sign itself, however its use on money seems to have reasonable concensus among numismatists.
The symbol on modern money originally derives from a Spanish coin called the Pillar Dollar. The word dollar itself is derived from Thaler, the term for one of the early European coins, made in Joachimsthal, Bohemia, and adopted in many countries around the world ever since. This Spanish dollar was arguably the first great "world currency" - fueled by the rich hauls of precious metals, especially silver, drawn from Spanish new world claims, and accepted in most ports of trade in Europe and the Americas, much like the US dollar today. It was accepted in the United States, even after independence, for a number of decades, due to its reliability, availability, and wide acceptance elsewhere.
Now for the important part. The "pillar" in the name Pillar Dollar refers to the dollar sign you describe, appearing to be an S with two vertical bars. This usage of the symbol derives from the Spanish coat of arms, which features the metephorical Pillars of Hercules, an ancient title applied to the two points of land flanking the entrance of the Mediterranean to the Atlantic Ocean, which was in the minds of some cultures the "end of the world" - the place beyond which no more land existed. The pillars were represented metaphorically in images as a pair of columns, with a long flowing sash behind them, upon which was written "non plus ultra" - "nothing beyond." Those two pillars became the vertical bars of the dollar sign, and the sash curling in the wind became the S shape.
Many nations that have used the word "dollar" and it's derivatives for their money have, ever since, used some variant of that same symbol as well. It is also used in some nations descended from the Spanish colonies, regardless of the word used. There are arguments made about one vertical stroke versus two, whether the strokes are interrupted or pass all the way through, etc, but they all share this origin when used in numismatics.
A couple useful references include:
America's Money, America's Story by Dr. Richard Doty
Whitman Encyclopedia of Colonial and Early American Coins by Q. David Bowers.