Strictly mathematically speaking, the partition function is a sum of exponentials, which are each dimensionless.
From a probabilistic perspective, the partition function is the normalizing constant for the Boltzmann distribution; if the partition function takes value Z, then the probability of any state of your system is given by P_state = exp(-E_state/T) / Z. Since the numerator is dimensionless (it represents an unnormalized probability), and the left hand side represents a probability (which is dimensionless), the denominator Z must also be dimensionless.