Yes, you can marry anyone you like, unless it happens to violate local laws. Some U.S. states, for example, don't recognize a marriage between close family members or people under a certain age. But such situations are rare. The person's immigration status (legal or not) has no bearing on whether your marriage will be recognized as legal.