子供の時、よく海で泳ぎました。
子供の時は、よく海で泳ぎました。
You might say the latter to imply...
"I used to swim in the sea in my childhood (but now I don't anymore)."
Here, the は is functioning as the contrastive particle (対比の「は」).
You might also say the latter when responding to a question...
"What did you often do in your childhood?"
-- "In my childhood, I often swam in the sea."
Here, the は is functioning as the topic particle (主題の「は」).
You'd say the former to just neutrally state that you would often swim in the sea in your childhood.
学生の時にもっと勉強しておけばよかったですよ。Here they use ni after toki. Is is the same as ... toki wa...?
>> 「学生の時はもっと勉強しておけばよかった」 sounds unnatural.