  We study star cluster formation at low metallicities of
$Z/Z_\odot=10^{-4}$--$10^{-1}$ using three-dimensional hydrodynamics
simulations. Particular emphasis is put on how the stellar mass distribution is
affected by the cosmic microwave background radiation (CMB), which sets the
temperature floor to the gas. Starting from the collapse of a turbulent cloud,
we follow the formation of a protostellar system resolving $\sim$au scale. In
relatively metal-enriched cases of $Z/Z_\odot \gtrsim 10^{-2}$, where the mass
function resembles the present-day one in the absence of the CMB, high
temperature CMB suppresses cloud fragmentation and reduces the number of
low-mass stars, making the mass function more top-heavy than in the cases
without CMB heating at $z\gtrsim10$. In lower-metallicity cases with $Z/Z_\odot
\lesssim 10^{-3}$, where the gas temperature is higher than the CMB value due
to inefficient cooling, the CMB has only a minor impact on the mass
distribution, which is top-heavy regardless of the redshift. In cases either
with a low metallicity of $Z/Z_\odot \lesssim 10^{-2}$ or at a high redshift
$z\gtrsim10$, the mass spectrum consists of a low-mass Salpeter-like component,
peaking at $0.1~M_\odot$, and a top-heavy component with $10$--$50~M_\odot$,
with the fraction in the latter increasing with increasing redshift. In
galaxies forming at $z\gtrsim10$, the major targets of the future instruments
including JWST, CMB heating makes the stellar mass function significantly
top-heavy, enhancing the number of supernova explosions by a factor of $1.4$
($2.8$) at $z=10$ ($20$, respectively) compared to the prediction by Chabrier
initial mass function when $Z/Z_\odot=0.1$.
