The commanders -- a lieutenant and a sergeant major of a combat unit -- were let go after they replaced a soldier's Facebook profile picture with a picture of a similar-looking nude man, Ynetnews reported Friday.
Before the prank, the commanders saw the sergeant access his Facebook account on a laptop. They then ordered their troops to a nearby training grounds to simulate a response to a sudden emergency.
While the troops were carrying out the drill, the commanders went into the soldier's tent and changed his Facebook photo to a picture of a naked man.
When he returned to his tent, the soldier said he had numerous messages on his cellphone from friends asking about the profile photo.
"I was devastated and barely left the house," the soldier told a friend.
The soldier filed a complaint with Israeli military Ombudsman Brig. Gen. Yitzhak Brik, saying the company commander merely reprimanded the lieutenant and sergeant major.
"Even if I accept their claim that the prank was not meant to humiliate you, I do not believe this kind of behavior can be tolerated," Brik wrote in response to the complaint.
Brik ordered the company commander to dismiss the lieutenant and relieve the sergeant major of his duties.