The idea that stacks can be identified with groupoids internal to the base site $S$ up to what is variously called essential/Morita equivalence is well known. The basic idea is that one takes the 2-category of internal groupoids and localises with respect to internal functors $f:X\to Y$ such that $$X_1 \simeq X_0^2\times_{f_0^2,Y_0^2,(s,t)} Y_1$$ ("$f$ is fully faithful") and the composite map $$X_0\times_{f_0,Y_0,s}Iso(Y_1) \stackrel{pr_2}{\to} Iso(Y_1) \stackrel{t}{\to} Y_0 \qquad (1)$$ is some sort of "surjective" map. What this means depends on the site one works with. For example, one could be working with Lie groupoids, then (1) is a surjective submersion. Or topological groupoids and (1) admits local sections. The oldest reference I know to this sort of functor is in
M. Bunge and R. Paré, Stacks and equivalence of indexed categories, Cahiers Topologie Geom. Differentielle 20 (1979), no. 4, 373–399.
where they take $S$ to be finitely complete and regular, and (1) to be a regular epimorphism. Bunge and Paré call the externalisation of such an internal functor a weak equivalence.
Is this the earliest reference to this idea of weak equivalences of internal categories/groupoids?