A demotion is when your rank or position is lowered by a superior. In the military, disobeying orders could result in a demotion.
In the military — as well as other careers — people usually move up the ladder with time, rising through the ranks. When your superiors bring you up to a higher level, that's called a promotion, like an assistant manager becoming a manager. However, if you're a manager and you get bumped back to assistant manager, that's a demotion. Demotions occur when someone has broken the rules or has done a poor job. Demotions usually come with a reduction in pay too.