It's from a 19th-century slang for coffee --- kaffi. The word is then inverted and turned into 'fika.'