Today, most countries have the similar education system, primary school, middle school, high school, where students spend 6-8 hours taking lectures and one professor giving lectures. Students sit in an organized fashion and are expected to pay attention to what professor is explaining for 30-50 mins. The lectures teach mostly general knowledge in different topics, history, science, mathematics etc.
So, I am wondering how did this start? Is it coming from a military based system in any way? And what alternative systems have been used throughout history?
Thanks, /u/Holy_Shit_HeckHounds for the tag! /u/aymat13, I'm happy to answer any follow-up questions you might have if you give the other answers a scroll.
I haven't written any answers that get at your second question and am happy to do here. No, it's not based on any military system. In effect, what you described in the first paragraph is basic knowledge transmission: a person who is knowledgeable about a topic passes that knowledge onto other people. As humans, we do that in a variety of ways including storytelling, the written word, songs, cultural norms, shadowing and mimicking, religious rituals and practices, and as you describe, lectures. So, it's difficult to speak to alternate systems as they're all based on the basic principal of how knowledge is transmitted from one generation to the next. (The only one that comes to mind is the idea of an autodidactic; someone who teaches themselves a subject or topic without the help of a tutor or teacher or any formal structure. But, as I explain below, they're still engaging in the same construct as formal education.)
So the roots of the modern education system can be found in that basic idea of knowledge transmission (or as Thomas Jefferson once called it, "the diffusion of knowledge.") The specifics you describe - breaking things down into subjects comes from a few different places but is based on the general idea that novices learn best from experts. This is the same thinking that shaped the apprenticeship model for craftspeople, and can be seen in a number of fields as well as early American education. The formal educational experience for the sons of those with access to power (which is to say, white men) was based on the idea that we get smarter by learning and studying what smart men know. Basically, the experts they learned from were thought to be experts at being smart. Slowly, over the course of the 19th century, the idea of specialized academic learning took shape and the modern (or English) liberal arts curriculum replaced the Classical liberal arts curriculum. The thinking shifted away from getting smarter by studying what smart men know towards we get smarter about and better at specific topics by learning about those specific topics from people who are more knowledgeable than we are. Want to get smarter about math? Best to learn from someone who is an expert in math. Etc.
In 1892, the National Education Association did a fairly massive survey of the state of American education and took stock of what patterns emerged throughout the country and discovered lots of commonalities related to the structure of the school day. While those who led schools and districts did belong to professional organizations and shared ideas, there has never been a national structure in the US. Meaning, there were no levers to press on to force schools to adopt a particular structure. Instead, schools across the country developed similar structures because they seemed to work for teachers, students, and the school community. The length of the school day was one of those - while there are some places where students go to school for 8 hours a day, 6-7 is more common and is based on the basic assumption that it's a manageable, doable length for young bodies. (Note that it wasn't until the 1920s or so - and the affordability of indoor plumping and HVAC systems that the full school day, school year became the norm across the country.)
I also want to touch on two other things you mention: the idea of lectures and sitting in an organized fashion. Lectures are, to a certain extent, a form of storytelling. And storytelling varies based on context, setting, purpose, and audience. So young children aren't expected to sit and listen to extended storytelling - teacher training in the 1820s explicitly warned teachers not to expect children to be able to sit for extended periods of time (changes in thinking about how to handle kids being kids was part of the feminization of the profession - while it's still allowed in some states - corporal punishment became a tool of last resort in classroom management as women teachers were typically expected to handle behaviors in other ways.) So, if we think of lectures as a form of storytelling, we can see how they shift and expand as the listener gets older, and the knowledge becomes more specific and sophisticated.
The nature of "organized fashion", like lectures, also shifts as children get older. One thing to keep in mind about photographs of schools is that until the modern era, they were rarely spontaneous. The goal was often to present the school in as good a light as possible - it was a place of pride for the community and the photographer typically wanted to capture that. So, children were often presented on their very best behavior but to be sure, when the photographer wasn't there, it was often far from orderly. (A recent plot on Abbott Elementary about footprints on desk tops has made an appearance in a teacher journal or two from days of yore.)
For collection of links check out History of the US School System written by who else but u/EdHistory101 (as they suggest, check their profile for a collection of history of education answers)
Much more can be said, but consider this comment written by u/EdHistory101 which tackles one aspect of the education system and links to other of their answers on that topic as well