That is values of captured groups by index. $1 is a first captured group, and $2 is a second captured group. As David pointed, these values used in replacement patterns.
string input = "Hello World";
string result = Regex.Replace(input, @"(\w+) (\w+)", "$2 $1");
Output: World Hello