Right now, a direct rail link to Afghanistan is not feasible, as it has to pass either through Pakistan or PoK.
While India does share a border with Afghanistan in the disputed PoK region, it is virtually impossible to construct any economical railway lines in the area. The entire PoK region (for hundreds of kilometers) is hilly and is home to some of the highest peaks in the Himalayas.
Any railway project here will be ridiculously costly. For comparison, the Jammu-Baramulla line, which only has one short section cutting through the...
more... lower Himalayas, is now costing us over 25000 crore rupees. By comparison, a railway line through the upper Himalayas in the PoK region and Afghanistan's eastern border, several 100 kilometers long, will easily cost lakhs of crores of rupees.
This much expense is completely unnecessary for the little international traffic, so there is no scope of this ever happening.