The quick fix is to change your command to
ssh host1 hostname & ssh host2 hostname &
";" and "&" are command terminators (newline(s) imply ";" unless there is a "\" to continue the line) and Bash does not allow empty commands.
&; means start the previous command in background (
&) and the start a
; command in foreground. The later one is empty and is not allowed by Bash.