Contact a local machine shop. Any competent machinist with a lathe can make it. You could also buy a rod and thread it yourself with a die. Or use cotter pins instead of lock nuts.
It depends on what it is on. Load, speed, etc matter. Cotter pins and washers are common for low speed applications. Threading becomes necessary where side play is unacceptable.
Is there anything particularly special about the threads, or just that you want a shaft with threaded ends? McMaster-Carr has those made to order in several materials:
Diligent_Nature t1_jdwjdm4 wrote
Contact a local machine shop. Any competent machinist with a lathe can make it. You could also buy a rod and thread it yourself with a die. Or use cotter pins instead of lock nuts.