South Korea's president replaces his defense chief, who said troops exercising martial law were acting on his orders.