It won't just uncouple itself, it is either a fault with the equipment or an error from staff in coupling it up.
There have been (rare) examples of the couplers failing leading to one of the jaws opening allowing the unit to break free. As said, if the driver or shunter hasn't put it together correctly then there is also a chance it could split once it starts moving.
The procedure would be along the lines of...driver gets the emergancy break application and looses interlock. Driver will fault find, part of which should involve looking out of the window to check the train is complete. There is of course a chance that the units havnt come apart far enough for the driver to notice from the looking back but at some point the driver will become aware of the division. The driver will let the signaller know and check that no one has fallen between units (only really applicable to corridor stock rather than block-enders).
The rest depends. Technically they can get permission from the signaller and try to re-attach the units. That is more use on the running lines though to clear the line. In reality I doubt they would authorise that and just let the train carry on in service, especially if it is still in the platforms at a terminal station. They would most likely cancel the train pending investigation. They would investigate weather the units were banged together correctly in the first place using things like data recorders, CCTV and staff statements (when we attach units in a platform we often give "one to the cameras" by over dramatically looking between to check the pins are out so if anything goes wrong and they check the CCTV they can see that we did properly look). They would then test the units to see if that's asset fault, they will have coupling testing equipment which they will use.
The driver wouldn't need to open the doors to let people off straight away, that wouldn't be a priority at that stage. Once they had realised what had happened and decided weather or not to re-attach and run the service they would make arrangements for getting punters off.