Discipline over the tiniest things, drill (the marching, shouting etc that you see), respect for authority, attention to detail and looking after equipment is absolutely necessary within the army because soldiers need to be able to take orders without question. Squaddies don't know what's going on when on operations. Only those higher up the chain know, and it's not always safe or possible for those actually on the ground to know the purpose of an operation or what's going to happen next. Training has to be tough and there needs to be respect for authority because without it, soldiers wouldn't do as they're told. If someone's telling you to do something within the army it's so that you don't get shot, or so others don't get killed. It's because those higher up than you are your eyes and ears.
Within the first couple of weeks of training for the army, you're basted by the officers. Every single little thing is scrutinised but it's all for a reason. Lack of attention to detail out in the field could mean not noticing an IED. Failure to look after your equipment down to the finest detail could mean your rifle jams at a crucial moment.
Drill teaches soldiers to work as a team. You learn to trust the man next to you, you learn how he moves, how to move as one with everyone else. You're ridiculed in training because it breaks you down and then builds you up, with the men you've trained with, so that you develop a bond which means you'd gladly risk your life to protect your friends.
Some people could never take being shouted at, but most soldiers know that it's for a purpose. It's all psychological. And you'd soon get used to it.