A similar way without the need for the contrapositive: get an arbitrary $x$ such that $x\in A$ and an arbitrary $y$ such that $y\in B$, then the set $\{x,y\}\in\mathcal P(A\cup B)$, by definition of the power set.
But now it must hold that $\{x,y\}\in\mathcal P(A)\cup\mathcal P(B)$, this mean that $\{x,y\}\in\mathcal P(A)$ or $\{x,y\}\in\mathcal P(B)$.
If $\{x,y\}\in\mathcal P(A)$ then $y\in B$, and because $y$ was arbitrary we have that $B\subseteq A$. In an analogous way if $\{x,y\}\in\mathcal P(B)$ we have that $A \subseteq B$.
EDIT: well, we need to formalize this proof a bit more to be a valid proof. Suppose an arbitrary $X\subseteq\mathcal P(A\cup B)$. If $A=B$ we are done. If $A\neq B$ then we divide four cases for $X$:
- $X$ is empty
- $X$ is composed of points exclusively of $A$
- $X$ is composed of points exclusively of $B$
- $X$ is composed of points of $A$ and points of $B$
Now we can check that when the four cases hold then the statement of the question hold.