"First, you pass by a big hospital."
It's how you show the relationship between そば and びょういん as they are both nouns. びょういんのそば means near the hospital (the vicinity of the hospital), びょういんのうしろ would be behind the hospital (the rear of the hospital).
びょういんのそばにあります means (It) is in the vicinity of the hospital (It's near the hospital), びょういんのそばをとおります means (It/you) passes through the vicinity of the hospital (You pass by the hospital).
I've been having the same problem, but I don't think it's the comma. For some reason when presented with an expression like "hajimeni" or "douyatte", and when given the choice between the entire expression on one button and splitting the expression up into multiple buttons (like "hajime" "ni" or "dou" "yat" "te"), Duolingo has been rejecting my answer if I choose the single-button option but accepting my answer if I choose the multi-button option. No idea why. Even last night, it was accepting the single-button option just fine.
(I don't have a Japanese-friendly keyboard at present, so I'm limited to the multiple-choice buttons on the screen.)
I answered with はじめに大きな病院のそばを通ります since there's no punctuation in the multiple choice tiles. It didn't mark it wrong, but I still got the whole "Another correct solution: はじめに、大きな病院のそばを通ります。" nonsense.
Is this a bug where it thinks the exact answer it's wanting you to input is "almost" wrong? Or is it just pointing out how it would look with punctuation inserted?
the に in this case is more about adverbially connecting the stem of the ichidan verb 始める、「はじめ」(a noun) to the verb of the sentence. This is seen as a conjunction, expression or opener of a statement, other similar ones are つぎに、さらに、それに、なのに、どうじに、ならびに。
はじめ "first", はじめに "firstly". Although in American English we prefer "first" in those cases for some reason.