Why is $\Delta G = -T \Delta S_{\mathrm{total}}$ valid only at constant pressure? According to my book(Elements of Physical Chemistry by Atkins and de Paula, 5th ed.), $\Delta G = - T \Delta S_{\mathrm{total}}$ is valid only for constant pressure and temperature. 

Enthalpy is defined as $H = U + PV$. So, when pressure and volume both are not constant, $\Delta H = \Delta U + \Delta (PV)$. So, enthalpy can be defined even if the pressure is not constant.

Now the criterion for spontaneity is that $\Delta S_{\mathrm{total}} &gt; 0$. But $$\Delta S_{\mathrm{total}} = \Delta S_{\mathrm{sys}} - \frac{\Delta H}{T}$$ where $T$ is the temperature of the surroundings. Now, if any heat enters the surroundings, the temperature of the surroundings does not change provided that the surroundings are large. I think that due to this the temperature of the system has essentially to be the same or infinitesimally greater/lesser than the surrounding temperature as the heat transfer has to take place reversibly. 

But now, as $G = H - TS_{\mathrm{sys}}$, $$\Delta G = \Delta H - T\Delta S_{\mathrm{sys}}.$$

Thus, from comparison of equations, $\Delta G = -T \Delta S_{\mathrm{total}}$. So, I did not need to specify that pressure is constant and why does my book do so?
You have actually assumed in your equations that both pressure and temperature are constant. Firstly, we have that

$$\mathrm{d}S_\text{total} = \mathrm{d}S_\text{system} + \mathrm{d}S_\text{surroundings}.$$

By definition, differential of entropy is

$$\mathrm{d}S = \frac{\delta q_\text{rev}}{T}.$$

From the first law of thermodynamics, and the definition of entalphy, for a reversible process

$$\mathrm{d}H = \mathrm{d}U + P\mathrm{d}V + V\mathrm{d}P= \delta q_\text{rev} + \delta w + P\mathrm{d}V + V\mathrm{d}P.$$

When all work done is to expand, then $\delta w = -PdV$, and thus

$$\mathrm{d}H = \delta q_\text{rev} -P\mathrm{d}V+ P\mathrm{d}V + V\mathrm{d}P = \delta q_\text{rev} + V\mathrm{d}P.$$

Only if pressure is constant, do we get the relationship

$$\mathrm{d}H \overset{\mathrm{d}P=0}{=} \delta q_\text{rev} \to \mathrm{d}S = \frac{\mathrm{d} H}{T}.$$

Therefore,

$$\mathrm{d}S_\text{total} = \mathrm{d}S_\text{system} - \frac{\mathrm{d} H}{T}\tag{constant pres., exp. work}.$$

Additionally for constant temperature, or $\mathrm{d}T = 0$,

$$\mathrm{d}G = \mathrm{d}H - S_\text{system}\mathrm{d}T - T\mathrm{d}S_\text{system} \overset{\mathrm{d}T = 0}{=} \mathrm{d}H - T\mathrm{d}S_\text{system}.\tag{constant temp.}$$

Hence the result $$\mathrm{d}G = -T\mathrm{d}S_\text{total}$$ is true when pressure and temperature are constant (in addition to possible other constraints).



It is probably not the best practice on my part to write things like

$$\mathrm{d}H = \delta q_\text{rev} $$

which has the impression of sloppy (but probably not wrong) notation. Interpret this as that, given our assumptions, the number $1$ becomes an integrating factor for $\delta q$, equivalent to the inexact differential becoming exact under special conditions.

A better option might be to write this expression with definite integrals, i.e., 

$$\int_{\text{state 1}}^{\text{state 2}} \delta q_\text{rev} = \int_{H_1}^{H_2}\mathrm{d}H.$$