If the subdomains are topologically-connected in the mesh, then solving for displacement in a CG function space defined on this mesh will strongly enforce displacement continuity at the interface. If you just vary the material properties on the two subdomains within a standard Galerkin weak form, that will also weakly enforce traction compatibility.
To see this, suppose the subdomains are \Omega_1 and \Omega_2, with \Omega = \Omega_1\cup\Omega_2. Galerkin’s method poses the weak problem
where \pmb{\sigma}_i is the Cauchy stress in \Omega_i. Integrating by parts on each \Omega_i, one gets
where \Gamma = \overline{\Omega}_1\cap\overline{\Omega}_2, i.e., the shared boundary or interface (and I’ve assumed that strongly-enforced Dirichlet and/or periodic BCs are enforced on any external boundaries), and \mathbf{n}_i is the outward-facing normal to \Omega_i. Because \mathbf{n}_1 = -\mathbf{n}_2 on \Gamma, the Euler–Lagrange equation corresponding to the \Gamma integral is
which is the stress continuity that you want physically, for equilibrium, while the volume integrals correspond to the strong form of -\nabla\cdot\pmb{\sigma}_i = \mathbf{f} on each subdomain.