We present infrared spectra of Gd 2 BaNiO 5 , which is isostructural to a prototype S = 1 Haldane compound Y 2 BaNiO 5 containing Ni 2+ chains, in the spectral range 2 meV-0.55 eV. Unlike Y 2 BaNiO 5 , the studied compound contains magnetic rare-earth sublattices and orders antiferromagnetically at T N = 58 K. Detailed information on optical phonons is given. Temperature dependences of frequencies and half widths for the two lowest-frequency phonons polarized along the Ni-chain direction evidence the interaction of these lattice vibrations with magnetic excitations. With the help of lattice-dynamics calculations, we find relative displacement vectors of ions for all the phonon modes and use them to discuss the mechanism of phonon-magnon interaction. The optical spectra exhibit a broad absorption continuum for radiation polarized along the chains, probably of magnetic origin, gradually decreasing with lowering temperature. A new mode at about 30 cm −1 polarized along the chains ͑a axis͒ emerges below ϳ150 K. A midinfrared absorption peak at 1306 cm −1 ͑0.16 eV͒ is observed and found to sharpen and shift significantly at T N . We argue that it can be attributed to a phonon-assisted magnetic absorption and discuss its nature in the framework of the Lorenzana-Sawatzky-Eder model.