They break up the ice-sheets when snow / ice freezes on your roof. You can literally die if a sheet of ice falls on you during the winter, its a rather traumatic event. These guards help prevent this disaster, especially in areas where people tend to be walking around (aka: around homes).
idk if this is the same, but in my country we have things looking like tiny ladders standing on their side in exactly that location on roofs to stop a big load of snow going down at once, possibly hurting someone unsuspecting standing below
They keep built up snow and ice from sliding off of the roof and injuring people. You’ll usually see them on roofing near or overhanging walkways and sidewalks.
They are ice and snow catcher things. They come in different forms, sometimes bars and these new versions in your picture. They hold the snow and ice in place during the winter.
Ice and snow will build up and weigh a ton, sometimes literally, and that weight falling on someone could easily kill them. With this system you are far less likely to have the entire sheet come down and it lets the cold stuff melt on the roof instead on people's heads.