Exactly. It means the same.
However, that said, there somewhat of an implication that if you just say “I went to the hospital<fullstop>” it most likely means you went as a patient. If you go there to visit someone, you'd most likely say “I went to the hospital TO SEE MY DAD.” (or whatever).