It sounds like one of two things happened here. Either the car was not legally parked and the police that arrested you impounded the vehicle after the arrest or your car was towed by the owner of the property as you did not have permission to have your car parked there. Either way yes it is legal.
There are any number of possible explanations as to why the car may have been impounded, such as the car either being parked illegally or not being permitted to being parked on the private property. If either scenario is true, then under the circumstances, it was probably legal.