It originated with the Tiberian Masoretes as part of the extended system of niqqud (vowel points), and has the opposite meaning of dagesh qal, showing that one of the letters בגדכפת is to be pronounced as a fricative and not as a plosive, or (sometimes) that a consonant is single and not double; or, as the opposite to a mappiq, to show that the letters ה or א are silent (mater lectionis).
[1] (e.g. Exodus 20:13,14,15; Deuteronomy 5:13,17,18,19; 2 Samuel 11:1; Isaiah 22:10; Jeremiah 20:17; Psalm 119:99; Zechariah 5:11) In some siddurs (e.g. those printed by ArtScroll) a diacritical symbol, typographically the same as the rafe, but utterly unrelated, is used to mark instances of "moving sheva" (Shva Na).
[2] The rafe is similar in function to the buailte (dot above, denoting lenition) in the old-style Irish alphabet.
In Ladino the rafe, called a varrica (“little crossbar”), looks more like a breve-shaped diacritic (ﬞ ) on top of the letter (◌ﬞ).
In words of Romance origin, [s] is spelled as ס, freeing up ש for the voiceless postalveolar fricative [ʃ] without the need for a rafe to disambiguate.