Muscle memory is loosely defined as a kind of movement one makes that over time the muscle becomes familiar with. A good example would be babies that do not possess muscle memory for such activities like walking or crawling. In order for their muscles to become familiar with these activities is for the baby to actually learn how to do these activities and continuously practice them and mastering it through trial and error. As the baby slowly gets familiar with the activities, the baby gets more adept in what he or she is doing and makes lesser mistakes until finally the baby can now do the activities instinctively without any mistakes.
The exact mechanisms that comprise muscle memory is not known but scientists think that any person who tries to learn a new activity or is practicing an old one will have increased brain activity when they do the said activities. What happens is that new neural pathways are formed in the brain that helps the muscle gain a sense of muscle memory. This means that when performing the activity the muscles will gradually become familiar to the said processes involving the said activity. The person doesn't have to tell the body to perform the said activity, the body will just instinctively know how to do it because the neurons in the brain will communicate with the muscles to do this activity.
Muscle memory is very important in many different types of training, especially in the field of sports.