Once dark matter has been discovered and its particle physics properties have been determined, a crucial question rises concerning how it was produced in the early Universe. If its thermally averaged annihilation cross section is in the ballpark of few$times 10^{-26}$ cm$^3$/s, the WIMP mechanism in the standard cosmological scenario (i.e. radiation dominated Universe) will be highly favored. If this is not the case one can either consider an alternative production mechanism, or a non-standard cosmology. Here we study the dark matter production in scenarios with a non-standard expansion history. Additionally, we reconstruct the possible non-standard cosmologies that could make the WIMP mechanism viable.