Those orbits can sometimes cause two galaxies to pass quite close to each other to produce interesting results. Solid objects, like planets, can pass near each other with no visible effects. However, galaxies are not solid, and can undergo inelastic collisions, which means some of the energy of the collision is transfered internally to the stars and gas in each galaxy. The tidal forces will often induce star formation and distort the spiral pattern in both galaxies. If enough energy is transfered internally to the stars, then galaxies may merge .
Galaxy mergers are most frequent in dense environments, such as galaxy clusters.