By solving the full-dimensional time-dependent Schrödinger equation with the thermal-random-phase wavepacket method, we investigate the photoassociation (PA) process of hot (1000 K) magnesium atoms induced by two time-delayed femtosecond laser pulses. Driven by the 840 nm fs laser pulses, the Mg2 molecules can be formed on the four excited states, (1)1Πg, (1)1Πu, (2)1Πu, and (2)1Σu+, from the initial electronic ground state X1Σg+. It is found that the three-photon couplings between X1Σg+ and the three ungerade states [(1)1Πu (2)1Πu, and (2)1Σu+], play dominant roles in the population transfer process. By scanning the pulse duration τ from 50 to 200 fs, and varying the delay time δt0 from 0 to 2τ fs, we find that the final PA population is strongly dependent on the two parameters. For a given δt0, the parameter τ can induce a significant variation (2 ∼ 6.8 times) for the final PA population transfer, and for a given τ, one can also obtain a significant variation (2.7 ∼ 3.5 times) of the final PA population by varying δt0. Additionally, the dynamics of the coherently vibrational wavepackets of the four excited states are also influenced by the two parameters.