The broad goal of trade unions is to make collective bargaining possible. In the absence of collective bargaining, it is difficult, if not impossible, to negotiate on anything approaching equal terms with management. A strong union prevents management from dividing labor in negotiations. The ultimate goal, of course, is to secure better working conditions and compensation for workers.
That depended on the union. In general, the object was to get better wages and better working conditions for the workers. There were, however, some labor unions that were more radical. These, like the Knights of Labor or (especially) the International Workers of the World, wanted to destroy the capitalist system so workers wouldn't be exploited any longer.