You can use minipage, with a big enough width, since you're specifying the line breaks.
\documentclass{article}
\usepackage[percent]{overpic}
\begin{document}
\begin{overpic}[width=0.5\textwidth,grid,tics=10]{example-image}
\put (20,50) {\begin{minipage}{\textwidth}first line text\\second line text\end{minipage}}
\end{overpic}
\bigskip
\begin{overpic}[width=0.5\textwidth,grid,tics=10]{example-image}
\put (20,50) {\begin{minipage}[t]{\textwidth}first line text\\second line text\end{minipage}}
\end{overpic}
\bigskip
\begin{overpic}[width=0.5\textwidth,grid,tics=10]{example-image}
\put (20,50) {\begin{minipage}[b]{\textwidth}first line text\\second line text\end{minipage}}
\end{overpic}
\end{document}
Note that the placement (20,50) refers to the reference point of the minipage: centered between top and bottom with no optional argument, the baseline of the top line with [t] and the baseline of the bottom line with [b].

You could also do
\begin{tabular}{@{}l@{}}first line text\\second line text\end{tabular}`
or with \begin{tabular}[t]{@{}l@{}} or \begin{tabular}[b]{@{}l@{}} to the same effect.
\begin{document} \begin{overpic}[width=0.5\textwidth,grid,tics=10]{example-image-duck} \put (20,50) {\begin{tabular}{l} first line text\ second line text \end{tabular}} \end{overpic} \end{document}`
– Sep 07 '19 at 17:22parbox: `\documentclass{article} \usepackage[percent]{overpic}\begin{document} \begin{overpic}[width=0.5\textwidth,grid,tics=10]{baum} \put (20,50) {\parbox{3cm}{first line text \ second line text}} \end{overpic} \end{document}`
– Vladimir Sep 07 '19 at 17:29