You can omit the "se" and just say "mientras que lo hubieras devuelto en dos semanas"; I mean, this would also be grammatically correct, but it would be missing "to her" which is what "se" is there for. The thing is, even if we omit "se", the fact that the money is been returned to "her" is implicit/understood by the context, so you could drop it and the message will be the same.
But the function of that "se" is that of a "le" as an indirect object pronoun. Have a look here for le/les become se.
I hope it clarified it.
Sign in to submit your answer
Don't have an account yet? Join today
Test your Spanish to the CEFR standard