을 in your phrase is different from the object marker particle 을/를 that comes after a noun.
- 1학년이었을 당시 = 1학년이었(다) + -(으)ㄹ + 당시.
-(으)ㄹ is defined as a verb ending that indicates
- conjecture, expectation, or future (this has similarities with English's to infinitive, as in 먹을 것 = things to eat, 내가 할 일 = work for me to do).
- tenseless adjective-making ending with no special meaning. Ex) 어렸을 떄 = when I was small, 고등학교(를) 다닐 때 = when I attended high school.
1학년이었을 당시 is a #2 case of above, meaning "when / at the time I was a first grader". The phrase is most often used as an adverbial phrase/clause in a longer sentence, as in 내가 일학년이었을 당시(에) 김 선생님이 우리 담임선생님이셨다 = When I was in first grade, Teacher Kim was in charge of our class (adding 에 is the more proper way but it can be omitted in speech).
-(으)ㄹ used in the past tense like in this phrase can confuse learners because -(으)ㄹ is also what makes the future tense by combining with 것이다 (e.g. 비가 올 것이다 = It is going to rain) and so you wouldn't expect the same construct to appear in past tense phrases. You could rephrase 1학년이었을 당시 as 1학년이었던 당시 (던 is only used in past tense) without changing the meaing, but 이었을 당시 sounds better in this kind of phrases. I think the reason has to do with -(으)ㄹ giving a more direct and vivid sense of recalling the time as if it's really happening in the speaker's head, but it is hard to find a definitive explanation for this.