Dehn gave at least three solutions of the conjugacy problem for surface groups, which can be found in my translation in the book Papers on Group Theory and Topology (Springer 1986), Papers 2, 4, and 5.
The first is based on an idea of Poincaré: lifting a curve to the universal cover, which is the disk model of the hyperbolic plane, replacing it by the hyperbolic straight line with the same endpoints, then projecting this line back to the surface as a "geodesic representative" of the original curve. Two curves are free homotopic (and the corresponding group elements are conjugate) if and only if they have the same geodesic representative.
This unpublished proof is conceptually simple, but it is not clear how to determine whether two curves have the same geodesic representative. Dehn's first published proof (Paper 4, 1912) worked out a way to do this, arriving in a roundabout way at Dehn's algorithm.
Shortly afterward (Paper 45, still in 1912) Dehn noticed that the algorithm follows easily from combinatorial properties of the tessellation of the universal cover, and the hyperbolic metric is irrelevant. This is essentially the proof we use today.