The Accessible Rich Internet Applications specification provides accessibility features for disabled individuals, as stated in the RFC:
Accessibility of web content requires semantic information about widgets, structures, and behaviors, in order to allow assistive technologies to convey appropriate information to persons with disabilities. This specification provides an ontology of roles, states, and properties that define accessible user interface elements and can be used to improve the accessibility and interoperability of web content and applications. These semantics are designed to allow an author to properly convey user interface behaviors and structural information to assistive technologies in document-level markup.
You can skip these codes if you don't care about supporting accessibility for disabled individuals, particularly if it's for your own website or Lightning components you use internally in your org. However, if you're trying to sell an app to government entities and some other orgs, your app may not be recommended or possibly even rejected if it does not meet Section 508 Requirements (in the United States), or similar requirements that may be enforced by other governments around the world.