What is the purpose of froth in washing clothes?
The froth has little or no effect on the detergent action. In fact detergent manufacturers have to add anti-foaming agents to stop excessive foam generation in automatic washing machines.

Froth/foam is generated because surfactants in the detergent adsorb at the air water interface and stop the water film that makes up the walls of the bubbles from collapsing. Note that the surfactant does not cause bubbles to form - bubble formation is always energetically disfavoured and the foam is only kinetically stabilised. The foam is caused by agitation entraining air into the surfactant solution so the amount of foam will depend on the intensity of the agitation as well as the type and concentration of the surfactant.

It is conceivable that in some cases the foam may assist with dispersal of mineral soils. This is the basis of the industrial froth flotation process. However this plays at most a very minor role in domestic washing machines. Not that it's directly relevant, but I mention it out of interest, foam is thought to play a role in cleaning teeth i.e. in toothpaste. It entrains particles of food so they can be spat out along with foam.