A canonical ensemble in statistical mechanics is an ensemble of dynamically similar systems, each of which can share its energy with a large heat reservoir, or heat bath. Equivalently, the members of the ensemble can be considered loosely-coupled to each other so that they can share the total energy. The distribution of the total energy amongst the possible dynamical states (ie the members of the ensemble) is given by the partition function.
A further generalisation of this is the grand canonical ensemble in which the systems may share particles as well as energy.
See also microcanonical ensemble in which the energy of each individual system is fixed.