The answer is 'yes'.

First, note that we may assume that $X$ and $Y$ are irreducible, since a standard innermost disc argument shows that any compressing disc can be made disjoint from any essential sphere.

Since the boundaries of $X$ and $Y$ are incompressible, it follows from Dehn's lemma and the Sphere theorem that their fundamental groups are one-ended.

Now, by Shenitzer's Lemma (see, for instance, Theorem 18 of https://arxiv.org/abs/1102.2866v2), it follows that the fundamental group of the glued manifold is also one-ended. In particular, the boundary is incompressible.