First impulse
It is thought by some that Brahms was first prompted to compose a requiem by the death of his friend Robert Schumann in 1856. There is little likelihood that he could have undertaken this at the time since he had been supporting Schumann’s wife Clara during her husband’s last two years of illness and, when Schumann died, Brahms was in the middle of a crisis in the creativity department. The idea of an unfulfilled desire to write a requiem seems quite plausible, though.
Choice of text
Since his early years Brahms had been an avid reader and deeply interested in literature. So he was in the habit of choosing works of literary weight to set to music, rather than more obvious lyric poetry (which would have been easier to set).