I've figured out a possible way to do this, so I want to post my answer here for future reference and anyone else that might find it useful.
There is a free plugin called "WP Remote Users Sync", here is the page for it, it is also on github.
This pluign only works on individual single sites (ie it won't work for Wordpress multisite since multisite uses a single installation of wordpress). Since a subdomain is essentially two separate sites where you can install two instances of Wordpress, one on the main site and one on the subdomain, I installed this plugin on both the main site and the subdomain (which also runs on Wordpress).
Setting up the plugin:
Access the plugin via Settings -> WP Remote Users Sync. In the plugin settings on the "Security" tab, add a passcode key (can be anything as long as it is the same for both sites) to the "Action Encryption Key" and the "Action Signature Key" and save.
Then in the "Remote Sites" tab, there is a place in the bottom right corner where you can add a remote site to sync with. I put the site that would be remote relative to the site I am in the settings for (ie if I am in the main site, the remote site is the subdomain, so in the settings on the "Remote Sites" tab, I put the URL of the subdomain, and vice versa). Save it to create a new remote site, it wll be listed in the Remote Sites tab.
Click the one you want to edit, ticked all the boxes you want to sync in the appropriate direction (eg Outgoing Actions for the main site would mean whatever happens on the main site, also happens on the subdmain). Do it in reverse on the subdomain site (ie instead of ticking the boxes in the outgoing actions column, I ticked them in the Incoming Actions). After saving, you can test it by clicking on "Test", a red cross means there is an error, it will tell you what the error is, a green tick means it has been set up correctly.
I tested this and when working properly and if the appropriate check boxes are ticked, any new user that signs up to the main site will also get signed up to the subdomain site automatically. It seems existing users have to be added manually using the import export function of the plugin. I have not figured out how to make their user roles sync, the users that get imported to the subdomain site gets whatever the default role on the subdomain is. When the users are synced properly in the right direction, users who log in to the main site are also automatically logged in to the subdomain. People who attempt to log in to the subdomain but have not registered on the main site will not be able to.
The next part is the restriction part: use user roles (you can choose which role to sync and export) and a restriction plugin to control what user role can see the content on the subdomain. You may need to manually approve new registrants on the subdomain, else anyone can log in and see the things there.
The issue I now have is how to hide pages of a website that is not a wordpress "Page", ie some pages are dynamic and generated by a plugin and not listed in the wordpress dashboard Pages section so I can't put a short code on that page.
domain.com
tosubdomain.domain.com
so that it would be able to carry across their identity and permissions. And I don't think that's a stable way to do things. Even something as simple as putting the subdomain behind HTTP Authentication and then automatically logging them in would require them visiting the main domain.