Basically you want to read the documentation for read-from-minibuffer and completing-read regarding the HIST argument which each of those functions accepts. There are other functions with history support of course, but these two are the standard/basic options.
Persistence is provided for by the savehist library, which writes to the file in savehist-file (which by default is ~/.emacs.d/history, but the old ~/.emacs-history will be used instead if that file exists -- in which case you might want to rename it to the modern preferred path).
Here's an example:
(defvar my-ssh-history nil)
(eval-after-load "savehist"
'(add-to-list 'savehist-additional-variables 'my-ssh-history))
(defun my-ssh (args)
"Connect to a remote host by SSH."
(interactive
(list (read-from-minibuffer "ssh " nil nil nil 'my-ssh-history)))
(let* ((switches (split-string-and-unquote args))
(name (concat "ssh " args))
(termbuf (apply 'make-term name "ssh" nil switches)))
(set-buffer termbuf)
(term-mode)
(term-char-mode)
(switch-to-buffer termbuf)))
(savehist-mode 1)