The supposition of your commenter ("I suppose this is a type of apostrophe") is correct. Also known, from another frame of reference, as 'direct address' or, more generally, a 'grammatical shift for rhetorical effect', the device is very common in poetry and lyrics. The claim has been made, perhaps most famously by Culler in The Pursuit of Signs (1981), that apostrophe is the defining or fundamental lyric trope.
Known in Arabic rhetoric as 'iltifat' (variously transliterated), the rich use of apostrophe in the Qur'an is sometimes used as a vehicle to illustrate or explain that work's untranslatability, inimitability and unique character. See, for example, "Apostrophe: A rhetorical device of the Qur’an". From the abstract:
Yet, apostrophe or “iltifāt” in Arabic as a rhetorical device is distinctly used in the Qur’anic
discourse. This Qura’nic unmatched utilization of apostrophe aims at expressing a particular meaning or set of
meanings by alternating between the use of first, second and third person pronouns, i.e., moving from the speaker
to the addressee or the absent or vice versa to elucidate the same message.
The paper provides many examples and a detailed analysis of some Qur'anic apostrophes. Another paper, which explores a similar thesis, is "What is the Qur’ans Literary Form?". From that paper:
...the Qur’an uses literary and linguistic devices in such a way that has not been used before and achieves an unparalled communicative effect. This use of language, called stylistic variation or stylistic differences, includes, but is not limited to, ...Grammatical shifts (iltifaat), ....
This feature [iltifat] is an effective rhetorical
device that enhances the text's literary expression and achieves the communicative goal; it is an accepted, well researched part of Arabic rhetoric.
These grammatical shifts include changes in person, change in
number, change in addressee, change in tense, change in case
marker, using a noun in place of a pronoun and many other changes. An
example of this complex rhetorical feature is exhibited in the
following verse. It changes to talking about God, in the
third person, to God Himself speaking in the first person plural
of majesty: “There is no good in most of their secret talk, only in
commanding charity, or good, or reconciliation between people. To
anyone who does these things, seeking to please God, We shall
give a rich reward.”
EDIT: Before composing the answer given above, I went back and forth between interpreting the question as referring to one form of address, the second person direct address or 'apostrophe', and interpreting the question as referring to the shift from third to second person. Perhaps capriciously, I chose the former interpretation. If the latter interpretation is more precisely what the question entailed, the device employed would be more profitably examined as 'digression' (of which 'apostrophe' may be considered a type) or 'parenthesis'.