Fritzi the goat ran onto the tracks from the platform and was slightly injured by an incoming train, the Süddeutsche Zeitung reported.
He was spotted running on the train line by the driver, who gave a warning whistle, but was unable to stop the train in time and the carriage touched the animal's head.
The animal was concussed and had to be pulled from underneath the train by the fire service.
Meanwhile, Fritzi's owner who lives nearby had noticed her pet was missing, Bild newspaper said.
After she heard the driver's warning whistle she went to the station, where the fire service returned her goat to her.
It was not clear how Fritzi got into the station, presumably he had pushed the gate open with his horns.