I've been involved in building structures with shipping containers. Even on solid ground, if you've got more than one layer, they tend to be connected together via twistlocks through the corner castings - these are on all eight corners of the box, and are designed to take other lifting and securing accessories as well*.
I find it hard to imagine that they are not connected on container ships. An individual laden container's weight may be very considerable, but I cannot believe that weight alone would provide enough structural integrity to ensure the cohesion of the whole in pitching seas, or - as in this case - an impact at speed. (I also assume - and this really is just an assumption - that lighter loads are stacked higher; makes sense from a structural point of view, but it also means that the units more prone to shift are higher up the stack.)
That said, I also wouldn't be surprised if the connectors themselves can't take the kind of forces involved in this collision.
*I've been involved in one project where connectors which I believe were specifically designed for the lifting of containers by Chinook helicopters had to be bought - at great expense - from the US. (I'm not sure why Chinooks don't pick up straight from the corner blocks like the usual Hiab, or - to be honest - why they were necessarily needed on this particular project. The structure involved overhangs - may be that the connectors simply had the highest rating available.)