The easy way would be to install
ssh-askpass. This is the program that
ssh-add runs when its standard input is not a terminal but an X11 display is available. The program
ssh-askpass prompts for your passphrase in a separate GUI window.
If you want to stay within Emacs, or if you want a solution that works whether X11 is available or not, you can make Emacs prompt for the passphrase. Here's some Lisp code (minimally tested) to do this.
(defun ssh-add-process-filter (process string)
(if (string-match ":\\s *\\'" string)
(process-send-string process (concat (read-passwd string) "\n"))
(message "%s" string))))
(defun ssh-add (key-file)
"Run ssh-add to add a key to the running SSH agent.
Let Emacs prompt for the passphrase."
(interactive "fAdd key: \n")
(let ((process-connection-type t)
(setq process (start-process "ssh-add" nil
"ssh-add" (expand-file-name key-file)))
(set-process-filter process 'ssh-add-process-filter)
(while (accept-process-output process)))
(if (eq (process-status process) 'run)