First, verify the terms in your plan. If it is an individually directed plan (you manage your own investments) you can likely distribute the funds any time. Just ensure that if your company owes you a match or other contribution, that it is funded prior to your taking funds out. You would not lose it, but could be charged fees for extra distributions. If it is a pooled plan, where the sponsor company determines the investment, it is possible that you have to wait for an annual accounting before you can take it out.
Once you determine for sure if you can take it, you should realize the cost of doing so. If you are under 59 1/2 years old, it will be assessed a 10% penalty, payable with your taxes in the year of distro. Additionally, you will be required to count the entire distribution as income and pay taxes on it as well (unless it is a Roth, where you have already paid the income taxes).
You can also roll it over to an IRA at your bank or with a mutual fund company like Vanguard, where it can continue to grow until retirement where it is intended to help you be more comfortable. Good luck and take your time in this decision. It is not one you can reverse.
The short answer is YES. If you put money in, it is yours to take out at any time. And sure, there are many things you should consider before doing so. What taxes would be levied against you? What penalties, if any would you have to pay? Is the reason you need your money due to financial hardship? Health care costs? First time home buy? What are the fees, if any will be billed to you if you keep the 401K at the former employer? Find a Financial Advisor that will talk to you without charge for an initial consultation.
Hey Bud, I wish you the best.