Yes, fire alarms are required by law in most buildings, including homes, apartments, and commercial buildings. The specific requirements vary by location and building type, but generally, fire alarms must be installed in every sleeping area and on every level of a building. It is important to check local building codes and regulations to ensure compliance.