Structural Integrity is one of the largest features within Medieval Engineers. This is what brings the game to life as this game mechanic is the pure foundation of true medieval engineering.
Structural Integrity is how well a build holds together. If a building is built too dangerously without taking the proper precautions and building supports then the whole building can be compromised to collapse. One way to help prevent collapse is to build a good foundation. This includes either building into the ground or terraforming the landscape to support your structure at least at it's base to make it more secure. Another helpful tip is to not build structures higher than eight blocks right. Generally structures can be built to higher heights but it all depends on their supports and architecture.
Always at risk of collapsing
There is not only the threat of buildings collapsing. The first way is the most common and its just simply the case that the building wasn't properly supported. The other common means of destruction is taking damage from external threats. There is always the chance of an aggressive barbarian or player that may compromise the building's integrity.
If you are struggling with building structurally sound buildings then consider taking some time and testing out building in creative while structural integrity is on. Also some of the Creative Controls are very helpful when learning about structural integrity. Especially the key, in which toggles structural integrity view as shown in the image.