If you're a landlord and someone else has moved into the apartment or home without permission then you can take that person to court and evict that tenant even though they have no lease.
It will likely be easier to kick the tenant out if they do not have a lease to the place but sometimes it may not be as easy.
If you have a roommate who is not on the lease with you then technically you are considered that roommates landlord even though they have no lease.
You would then need to take the roommate to court to have them evicted from the apartment or house and you cannot just kick them out and change the locks etc.
Or even if you own a home and you have a tenant without a lease in your home then you would have to take the tenant to court to actually evict them even when you have no lease.
You should always have the tenant or roommate sign a lease when you allow them to live with you so that it's easier to evict them for something they should be evicted for.