There are no rules that restrict where players must be positioned on the field. When a team has a corner, or set piece in the opposition half, it is common for both of the center backs to go into the opposition box and attack the ball. They are needed in these situations due to their height and physicality for high crosses into the box. When they go forwards it is important that other members of the team cover their position until they are able to get back.