The Straight Dope:
"what you take to be an f is actually the so-called long s, also known as the medial s, to be differentiated from the terminal or short or round s, which we regard today as the conventional form. Throughout its history, the long s has always looked a lot like the lowercase f, to the extent of having a little nubbin vaguely reminiscent of a crossbar appended to its middle sometimes. But the two letters are not otherwise related.
As one might deduce from the nomenclature, the long/medial s was supposed to be used in the middle of a word, while the terminal s was used to finish one off. (In practice this rule was somewhat haphazardly adhered to.) The two versions were phonetically equivalent and derived from the same Roman letterform. Why folks figured they needed two varieties when they could have scraped by with one is beyond me, but we might note that having terminal and middle letterforms is not inherently any nuttier than having every sentence start with a capital letter, a comparatively recent invention"