The officer had been taking part in a "routine operation" near the border fence between northern Gaza and Israel, a spokesman said.
"The IDF (army) confirms an IDF officer was killed overnight following misidentified (weapon) discharge during routine activity adjacent to the security fence in the northern Gaza Strip. The circumstances of the incident are being investigated," a military statement said.
Several hours later, Palestinian militants fired a rocket over the border which struck the southern Eshkol region, causing no injuries or damage, the army said.
The force was deployed on January 21, but withdrawn at the weekend as a protest after four overnight Israeli strikes on Hamas training facilities across the impoverished enclave.