Dihedral angle of gaseous and crystalline HOOH
You've already answered your own question - hydrogen bonding.
First, don't think of it as to why is the gas state different than solid-state.  Rather, think about why is the solid-state different than the gas state. In the gas state, there is very little intermolecular interaction (very, very few species do not follow the ideal gas law to many significant digits). The gas state geometry is close to what is expected for $\mathrm{sp^3}$ tetrahedral geometry and may be considered normal. The link below is a paper discussing the gas phase microwave spectroscopy of $\ce{H2O2}$ in far greater detail than I can hope to here. The description of the torsional rotation energies was not trivial.
Internal‐Rotation in Hydrogen Peroxide: The Far‐Infrared Spectrum and the Determination of the Hindering Potential by
Robert H. Hunt, Robert A. Leacock, C. Wilbur Peters, Karl T. Hecht, The Journal of Chemical Physics 1965, 42, 1931-1946, https://doi.org/10.1063/1.1696228,
mirror
When condensed to the solid-state, molecules get close enough to allow intermolecular forces (in this case hydrogen bonding to a much greater extent than van der Waals). Additionally, the energies of the crystal lattice must be considered.  In this case, th