Professor McGonagall is a licensed Animagus which means that she is certified by the Ministry of Magic to be in either her human form or cat form at will. She is also an exceptional witch with great skills in Transfiguration. She uses magic to transform into a cat and even has markings near the eyes, very similar to her glasses when she turns into a cat.