The short answer; yes, you should get a sewer inspection before buying a home.
A sewer line carries waste water from a home to the city's main line. Generally, the homeowner is responsible for their sewer line until it reaches the city's line. Ideally, your sewer line goes directly from your home to the street in front of your house.
However, sometimes a sewer can take an odd path to the main line. This is especially true in older neighborhoods. For example, I had a situation where my sewer line connected to the next door neighbor and then traveled another 100 feet through my neighbor's backyard before reaching the main line. If this ever needs repair, it will be very expensive and involve digging into my neighbor's backyard. It will also involve a difficult conversation about shared costs.
Repairs to a sewer line involve digging up the ground to reach the line that can be 8 feet deep. This can include digging up your driveway, the sidewalk, the street, and your landscaping. Costs can run in the tens of thousands of dollars. I've heard numbers upwards of $300/feet but this is completely variable.
A sewer inspection runs a scope through your sewer line to make sure that it runs without damage or blockage to the city's line. It can also determine the type of material that is used. Some older materials, such as orangeburg, have a limited shelf life and will eventually need to be replaced. A sewer inspection video basically looks like a colonoscopy. Make sure to actually watch this video yourself and save a digital copy. Yes, it's painful to watch, but it will give you a better understanding of your home.