That <ſ> shape of "s" is called "long s": https://en.wikipedia.org/wiki/Long_s
The long s was derived from the old Roman cursive medial s. When the distinction between majuscule (uppercase) and minuscule (lowercase) letter forms became established, toward the end of the eighth century, it developed a more vertical form.
The long s is used only at the beginning of a word or inside a word, never as the word-final letter, and it is graphically distinct from "f" in that it either has no horizontal bar at all, or the bar is only on the left side of the vertical stroke, while with "f" the horizontal bar crosses the vertical line.
In Germany, until 1945 when most printed matter was in the Fraktur typeset, the long s was always used. Even now in the German language there is a trace of the long s — the letter ß (Eszett or scharfes S in German) is a ligature of ſs.