South Korea's military has confirmed it fired warning shots after North Korean soldiers crossed the border on Sunday, possibly by accident.