If one has to be righteous to go to heaven…how does Satan go to and fro?

First heaven must be qualified. Heaven is known by many different names. It is known been as heaven, Abraham’s Bosom, and paradise. Heaven is departmentalized, because hell also has its place in heaven. An example would be Luk. 16:19-31, where a righteous man and an unrighteous man are present at the same time, and one is being comforted and while the other is being tormented. Please note, these men had to die, so that they became spiritual entities, before they could stand before God. Satan was created a spiritual being; therefore he already has access to God. Luke 16:26 states that there is a gulf separating the righteous from the unrighteous. Scripture does not indicate whether or not Satan is restricted to a certain area at this particular time, but in the future he will be cast into the Bottomless Pit. Perhaps it could be better stated, that only righteous beings can reside permanently in heaven; all others are just passing through until they reach their final destination.