Punctuation is used in all writing (not just in poetry) to ensure that the reader hears the words in his head in the same way that the writer heard them in theirs.
Sometimes punctuation can be omitted, as it may be assumed that the reader knows the rhythm of the words already. That might apply, for example, when writing out the lyrics of a song which has had chart success. (People reading those lyrics would hear the rhythm of the music in their heads anyway as they read the words, rendering punctuation unnecessary).
Similarly punctuation might be omitted when writing a limerick (because everybody knows the rhythms of a limerick).
Otherwise though, it's generally best to stick to exactly the same use of punctuation as you would when writing prose. Some poets can dispense with it altogether and still produce meaningful work but many others simply end up leaving readers unable to hear the rhythms which were intended to be present.
There's plenty on the internet about the subject but I'm particularly impressed with this short article, as it
(a) gives a perfect example of the 'normal' use of punctuation in a poem ;
(b) gives a counter-example, showing that some poems can work without any punctuation whatsoever; and
(c) warns against trying it yourself unless you're really confident that the reader will still be able to get the best from your work:
https://www.writingforward.com/poetry-writing/breaking-grammar-rules-in-poetry-writing