Student looking for help here, thought this was the subreddit with most experience in this field and hope this post is allowed. Is it a matter of having a solid understanding of how various events are interconnected or is it just muscle memory?
Well, having a solid knowledge of how an event affects another and in which way helps to give a dimension to the time and so knowing roughly how events are placed in a timeline. This works, of course, really well for brief periods of time, for example if you have to memorise events of the French Revolution. However, the same could be done for long period. I think it could be useful to imagine a timeline, put a few date as mark points and fill the blank spaces with civilisations, events and so on and associate them with dates. In conclusion, in my opinion, a solid knowledge of facts is the basis a of a solid knowledge of dates. If you don’t find this useful you may try the method of loci. You can find lot of accurate explanations of this technique online, but I’ll try to explain how it roughly work. It consists in creating an imaginary palace with rooms. In each room you put a few objects (5 or 6 I think) and you associate a date or a concept to each object. When you have consolidated this technique you’ll just have to imagine to walk into the room and you’ll know the date or the concept by seeing the object. Hope to have been useful.
I think understanding the long-term impact of large events is definitely key, as well as the logic behind periodizations (whether one agrees with them or not). If you're looking at the history of the Islamic world in the pre-Mongol Middle East (a bit less obscure than the pre-Islamic age, which is why I pick it) weighter toward Greater Iran, you might structure it by key events something like this:
Once you have a sense of roughly which order these events come in (some are concurrent) you become able to nail things down by memorizing key dates or ranges and constraining the ranges within which you need to remember things. For example, you might remember that the Mongols invade around 1200, Mahmoud Ghaznavid's reign begins around 1000, Harun al-Rashid dies a few years into the 800's, and Muhammad dies in the 630's. Then you know that, for example, the heydays of numerous powerful Iranian dynasties (Tahirids, Buyids, Saffarids, Samanids...) all must fit into the approximate range of 800-1000, and it becomes a matter of figuring out those on a more granular level.
This is generally what I do when I try to recall dates (I'm usually content to remember things to within a decade, then it's easy to look up if more precision is needed).