In Blue Bloods, Frank wears a uniform on occasion. In real life, the NYPD commissioner is a civilian and doesn't have a uniform. So, either in the canon of blue bloods, the PC has a uniform or he is wearing the uniform of his past days as a police officer. Is it ever explained in canon if Frank's uniform is not that of the PC, but a hold-over from when he was an officer? I noticed he wears 4 stars which denote the chief of department, a position he held before being appointed PC.
You are right. The NYPD Police Commissioner does not wear a uniform.
In the show, it's purely for effect.
Tom Selleck might have read Bill Bratton’s book, but he still managed to get one thing wrong about his character’s role. Frank Reagan can sometimes be found an all-black uniform on Blue Bloods. But that’s not quite true to real life. Bratton told him so at Elio’s, according to Page Six.
“In New York, the commissioner is a civilian,” explained telecaster Rikki Klieman. “In L.A., the police chief is a peace officer who reports to a board of commissioners.” So the police commissioner in New York doesn’t wear a uniform every day. But who doesn’t want to see Tom Selleck in a uniform?
Essentially, the production company thought it looked good.