The right focal length for astrophotography depends very much on the sort of thing you wish to photograph.
One style would be wide field using a wide angle lens. I've tried this occasionally for capturing shooting stars & general starscapes, but it would also be applicable to milky way shots, around 10 to 20mm often works well, but more normal focal lengths can work for single constellations or star trails.
To get shots of the whole moon, you need a much longer focal length, possibly even a hundred times longer than used for wide field. (~1000mm to fill the frame with the moon)
For planet shots & many nebulae longer focal lengths still are generally wanted!
These long focal length shots are usually done by connecting the camera to a telescope (multiple ways of doing this). The best sort of telescope to use will depend on the type of subjects you want to shoot. All the options I have available are at the very low budget end, which is part of the reason I've never managed anything much. However I have to admit lack of patience, post processing skills etc are also to blame.
I don't shoot Canon so couldn't recommend any Canon fit lenses, but before anyone can you need to decide what sort of astrophotography you plan on doing & how big your budget is. Skilled astrophotographers can get impressive images from kit as basic as mine (~$150 used), things get easier with reasonable quality guided telescopes that can easily run into the thousands, and the ultimate amateur scopes will cost more than a new car or even a house...
Fortunately wide field lenses don't go quite as high in price