%%%% Preamble >>>
\usepackage{subcaption}
\newlength{\twosubht}
\newsavebox{\twosubbox}
%%%%% <<<

\begin{figure}[htp]
  % preliminary
  \sbox\twosubbox{%
    \resizebox{\dimexpr.99\textwidth-1em}{!}{% {(num of image)-1}em
      \includegraphics[height=100cm]{first-image}%
      \includegraphics[height=100cm]{second-image}%
    }%
  }
  \setlength{\twosubht}{\ht\twosubbox}
  % typeset
  \centering
  \subcaptionbox{\label{fig:first}}{%
    \includegraphics[height=\twosubht]{first-image}%
  }\quad
  \subcaptionbox{\label{fig:second}}{%
    \includegraphics[height=\twosubht]{second-image}%
  }
  \caption{(\subref{fig:first}) First. (\subref{fig:second}) Second.}
  \label{fig:two-images-same-height}
\end{figure}
