Imagine it conceptually as the repair having to occur on the turn AFTER the damage was incurred.
So if on turn 1 your BB takes a hit, and it ends its turn adjacent to a naval port, the damage repair will occur on turn 2 during the purchase/repair phase.
Now keep in mind that if your BB gets damaged on turn 1, but does NOT end its turn adjacent to a friendly naval base, then you won’t be able to repair the damage on turn 2, because you’ll only have an opportunity to move your BB to a naval base during combat or noncombat movement phase, which happens AFTER the purchase/repair phase. So you’ll have to move the BB to the naval base on turn 2, and then repair it on turn 3.