The basic meaning of groove is "a long narrow channel or depression." When something falls into a groove, it has trouble getting out; "groove" therefore came to mean "a fixed routine :rut." Then from the notion of doing something routinely, it came to mean "a situation suited to one's abilities or interests :niche." These last two can help you to understand the phrase "to get one's groove back." Basically, it means "to return to what one normally does (well)" or "to return to what one formerly did (well)." I think it is often used within the context of dating, sex, etc.
An idiom on a colloquial level. The expression is used a lot in sports. The basketball star who shoots for a high average, the football quarterback who completes a high percentage of his passes and the baseball batter who slugs at an average of .380; they are all said to be in the groove. Once the averages begin to slump, groove is more or less forgotten until the high averages seem to drop out of the sky like an ex machina and the player is back in the groove.