Here is a trivial lemma.
Lemma. Let $f \colon X \to Y$ be a morphism of schemes. Then the natural map $f^{-1}\mathcal O_Y \to \mathcal O_X$ is an isomorphism if and only if for each $x \in X$ the natural map $\mathcal O_{Y,f(x)} \to \mathcal O_{X,x}$ is an isomorphism.
Proof. A morphism of sheaves on $X$ is an isomorphism if and only if it is so at the stalk of every $x \in X$. The stalk of a sheaf $\mathscr F$ at $\iota \colon \{x\} \to X$ is given by $\iota^{-1}\mathscr F$, so $(f^{-1}\mathcal O_Y)_x = \mathcal O_{Y,f(x)}$ since $\iota^{-1}f^{-1} = (f \circ \iota)^{-1}$. $\square$
Under reasonable finiteness assumptions, this gives a local isomorphism as Simon Henry suggested:
Lemma. Let $f \colon X \to Y$ be a morphism of schemes that is locally of finite presentation. Then $f^{-1}\mathcal O_Y = \mathcal O_X$ is and only if for every point $x \in X$, there exists an open neighbourhood $U \subseteq X$ of $x$ and an open neighbourhood $V \subseteq Y$ of $f(x)$ such that $f$ induces an isomorphism $U \stackrel\sim\to V$.
Proof. Suppose $f^{-1}\mathcal O_Y = \mathcal O_X$, and let $x \in X$. By the lemma above, we get $\mathcal O_{Y,f(x)} \stackrel\sim\to \mathcal O_{X,x}$. Let $V \subseteq Y$ be an affine open neighbourhood of $f(x)$ and $U \subseteq f^{-1}(V)$ an affine open neighbourhood of $x$. If $V = \operatorname{Spec} A$ and $U = \operatorname{Spec} B$, then the map $g \colon A \to B$ is of finite presentation (Tag 01TQ).
Letting $\mathfrak p \subseteq A$ and $\mathfrak q \subseteq B$ be the primes corresponding to $f(x) \in V$ and $x \in U$ respectively, we conclude that $g^{-1}(\mathfrak q) = \mathfrak p$, and the map $A_\mathfrak p \to B_\mathfrak q$ is an isomorphism. By Tag 00QS, this implies that there exist $a \in A\setminus \mathfrak p$ and $b \in B\setminus \mathfrak q$ such that $A_a \cong B_b$.
Replacing $U$ by $D(b)$ and $V$ by $D(a)$ gives open neighbourhoods $U \subseteq X$ of $x$ and $V \subseteq Y$ of $f(x)$ such that $f$ induces an isomorphism $U \stackrel \sim \to V$. The converse is trivial. $\square$
Examples include open immersions, disjoint unions, but also the map from a line with double origin to the line with a single origin.
However, if we drop the finite presentation assumption, we get all sorts of examples:
Example. Let $Y$ be any scheme, and consider the map
$$X = \coprod_{y \in Y} \operatorname{Spec} \mathcal O_{Y,y} \to Y.$$
For a point $x \in X$ in the component $\operatorname{Spec} \mathcal O_{Y,y}$, we get an isomorphism $(\mathcal O_{Y,y})_x \to \mathcal O_{Y,f(x)}$, as can be seen easily by passing to an affine open neighbourhood of $y$ in $Y$ and using standard properties of localisation of rings.