I was hospitalized because of illness.

Literal

Illness [by-で] hospital [to-に] was-hospitalized.

病院に入院した — 入院する means 'to be hospitalized.' で marks the cause. The redundancy of 病院 + 入院 (both contain 院) is natural in Japanese.