Investing as an immigrant or no

Hi, I was talking to my friends about the benefits of investing early in their lives… Some of my friends have only social security and work permits as legal paperwork. Can they still invest? Is it safe to do so? Where could they invest and take their money whenever they want to (just in case)? What advices do you have or what do you think of it?
Thanks.