Most men stop getting hard by age 65 to 70 years old.
However some men can have trouble getting erections and experience erectile dysfunction by age 40 to 50 years old.
The older you get the less sexual desire you get and you'll have a harder time getting erect and may need to take some erectile dysfunction pills.
The younger you are the better sexual performance you have and the older you are the less sexual performance you have.
It's normal to get less sexual desires as you get older and it's normal to not get as erect either when you are older.
However some older men even in their 70's and 80's can still get erect.