I apologize if this is old, but I recently worked out this problem, found this question accidently online, and as I had my work written down on paper next to me I decided to share this.
Let $M$ be a module over $A$, $N$ a module over $B$, and $P$ a bimodule over $A$ and $B$.
(i) Construct $M\otimes_A P$, this is a module over both $A$ and $B$, and furthermore, it is not hard to show that it is bimodule.
(ii) Construct $P\otimes_B N$, this is a module over both $A$ and $B$, and furthermore, a bimodule.
(iii) With the first two constructions, $(M\otimes_A P)\otimes_B N$ and $M\otimes_A (P\otimes_B N)$ will be bimodules over $A$ and $B$. We claim they are isomorphic as bimodules.
(iv) Fix $n_0\in \mathbb{N}$. Define the map $g_{n_0}: M\oplus P\to M\otimes_A (P\otimes_B N)$ as $g_{n_0}(m,p) = m\otimes (p\otimes n_0)$. It is an easy verification that $g_{n_0}$ bilinear over $A$. Therefore, we get an induced map, $\overline{g_{n_0}}: M\otimes_A P\to M\otimes_A (P\otimes_B N)$ such that $\overline{g_{n_0}}(m\otimes p) = m\otimes (p\otimes n_0)$. This map is linear over $A$, but a little computation will show that it is also linear over $B$ as well.
(v) Consider the map, $f:(M\otimes_A P)\oplus N \to M\otimes_A (P\otimes_B N)$ defined by $f(\alpha,n) = \overline{g_n}(\alpha)$ where $\alpha \in M\otimes_A P$. This map can be checked to be bilinear over $B$, and satisfies the property that $f(m\otimes p,n) = \overline{g_n}(m\otimes p)$. Thus, we get the induced map $\overline{f}:(M\otimes_A P)\otimes_B N \to M\otimes_A (P\otimes_B N)$. This map is linear over $B$, but some easy computation will show it is linear over $A$ as well. It satisfies the property that $\overline{f}((m\otimes p)\otimes n) = m\otimes(p\otimes n)$.
(iv) By repeating steps (iii),(iv), and (v), by interchanging the roles of these modules we get a map $\overline{h}: M\otimes_A (P\otimes_B N)\to (M\otimes_A P)\otimes_B N$ with the property that it is linear over $A$ and $B$, and $h(m\otimes (p\otimes n)) (m\otimes p)\otimes n$.
Now we have two maps $\overline{f}$ and $\overline{h}$ which are map over bimodules with $\overline{f}\circ \overline{h} = 1$ and $\overline{h}\circ \overline{f} = 1$. This is enough to conclude the isomorphism that we wanted.
Best Answer
This is a natural isomorphism of abelian groups, so it will respect any extra module structures which may be present; naturality in $M$ implies that if $M$ is a $(C, A)$-bimodule for some other ring $C$ then this is an isomorphism of $C$-modules, and naturality in $P$ implies that if $P$ is a $(B, D)$-bimodule for some other ring $D$ then this is an isomorphism of $D$-modules.
In particular, if all rings involved are commutative, then this is always the case with $C = A, D = B$, so we get an isomorphism of $(A, B)$-bimodules.