This depends a great deal on what aspect of WWI you are going to focus on.
To me, the war that was most like WWI was the American Civil War. That is because the Civil War was the other major war in which there was a great deal of trench warfare and many episodes of offenses trying to storm very strong defensive positions.
Both the Civil War and WWI were industrial wars before tactics had adapted. In both wars, the technological levels of the time strongly favored defense. The defenders could decimate armies that staged frontal assaults. Even so, the offensive tactical doctrines had not yet evolved to the point that frontal assaults were abandoned.
Because of these factors, both of these wars were similar in that both involved huge numbers of casualties incurred by frontal assaults on strong defensive positions.