I think your understanding is correct. Transformers do not encode the sequential nature of their inputs. Hence, we need positional encoding to add that notion during training. For an input sequence of length 512, it can consist of multiple sentences attached together and fed in a sequence.
eg: for an input sequence of length 8: a1 a2 a3 a4. b1 b2 b3 b4 which consist of two sentences: a1 a2 a3 a4 and b1 b2 b3 b4, the corresponding positions would be 1 2 3 4 5 6 7 8. This is still valid because a1 comes before a2 and b1 comes before b2. Although, it also implies a1 comes before b1 and that’s fine.