The Monte Carlo code Geant4 is used to demonstrate ultrafast gamma-ray line emission from the 12C +12C reaction driven by laser-accelerated ion beams. With carbon ions of the order of tens of MeV accelerated by laser-bombarding the carbon target, characteristic gamma-ray line emission is generated with durations as short as picoseconds through ultrafast gamma-ray transitions. Because the relative bandwidths of such gamma-ray lines can be reduced to less than 1% and the yield rate of gamma photons is around 10−5 for an incident carbon ion, this gamma-ray line emission can be used as an ultrafast monoenergetic gamma-ray source with a flux of 1.2 × 106 photons/J into 4π. We also show that the bremsstrahlung background induced by electrons accelerated simultaneously with the carbon ions can be mitigated by choosing a proper detection angle and an optimized target thickness.