This is not known. Some research suggests links between ALS and exposure to environmental toxins. However, these links lack evidence. Avoiding environmental toxins is always a good idea, but this does not guarantee someone will not get ALS.
However, a 2020 review notes that ALS shares essential molecular effects with aging, and it suggests that pro-aging strategies may help prevent ALS. One approach involves eating a balanced diet that is rich in antioxidants and anti-inflammatory foods early in life. Another approach includes engaging in low to moderate exercises regularly.