A bath or shower meets the wall at a joint that must accommodate the intended movement and water exposure. A suitable sealant and sound supporting details work together.
An open or detached joint needs attention, but it is not automatically the source of a stain below. Leaks, unstable support, damaged backing or other defects may need investigation before cosmetic resealing. Stop using a suspect leaking fixture and arrange appropriate help.