The problem with using \\
in \caption{..}
(a single mandatory argument) is that this defaults to \caption[..]{..}
(optional + mandatory), and \\
is problematic in the optional argument. If you specify an alternative non-\\
optional argument, then it's okay, but \\
is made "useless" or has no effect. You could use a tabular
to set the argument:

\documentclass{article}
\begin{document}
\begin{figure}
\caption[This is the caption; This is the second line]
{\tabular[t]{@{}l@{}}This is the caption \\ This is the second line\endtabular}
\end{figure}
\end{document}
Of course, if you don't need the optional argument (since you might not be using a \listoftables
), just use an empty optional argument. Without more context of the requirement, I'm not sure how useful it might be.
caption
package?