Required by many mortgage companies when you buy a house, primarily so they know that you care about paying the mortgage. If you buy a house and it turns out the foundation is completely falling apart and a wall falls down... you might just skip your mortgage and now the bank repossess a shitty house they lost money on. Also just a good thing to do overall before you purchase a house.
Edit: It's used primarily on the buyers side of the transaction prior to the actual purchase to validate the house is in good shape... Or oftentime to identify issues with the house that can be used to negotiate on the price a bit. Eg... someone is asking for 500k on a house and you found that the corner of the roof has some water staining on it (probably needs to be looked at). You can ask the Sellers to fix it, or negotiate the price down 2-3k based on the findings of the third part inspector.