When a body is buried in a coffin the coffin helps protect the body from decay at least for awhile.
The coffin helps seal out bugs, dirt and oxygen to prevent decay of the body.
However even in a coffin the body will decay after many years.
It may take 10 years to 20 years but eventually the bodies skin will decay and fall off the bones and then you'll have nothing but bones.
Eventually the seals will rot and decay and allow bugs and maggots into the coffin that will then eventually eat the body.
Some types of coffins do eventually collapse after many years.
However metal coffins may not collapse until 100 years or so later on.
Wood coffins will rot and collapse within a few years to 10 years and eventually the body will naturally decay and rot away to bones as well.
Coffins eventually do rot or corrode or fall apart after many years.
For wood coffins they usually rot within a few years to 10 years after being buried but other coffins may last until 50 to 300 years or more.
Eventually the body will rot out and decay to nothing but bones even in the coffin within 20 years time.
The reason we bury bodies in coffins is to prevent decay of the body and to prevent odors and protect the environment from the decaying body as well.
Also the coffin is used to allow family to view the body and easily lower the body into the grave.
Although people will still rot in a coffin it just takes a bit longer and eventually the coffin unless it's stainless steel will either rust away or rot away in the ground and expose the body.
Coffins have long been used when burying bodies to prevent the odor of decay and to give the family members closure and prevent them from witnessing the decomposition of their loved ones, and in many cultures it has been seen as a necessary step for the deceased to enter the afterlife or to give back to the cycle of life.
Although in reality there's nothing harmful to the earth by allowing a body to rot into the ground because it's natural.