Electric bicycles are legal in most countries around the world. They are regulated under the same laws as regular bicycles.
In some places, such as Australia, they are considered motor vehicles and require registration.
In other places, such as the UK, they are not considered motor vehicles and do not need registration. As long as you follow the rules set down by the local government, there shouldn't be any problems.
The US has different classes of separate types of electric bikes depending on the power and speed of the model. Each state will have their own laws on e-bikes, so make sure that you read up on your own area's laws.
Most states will agree that an electric bike should not exceed a maximum speed of 28 MPH and that they should be ridden on roads only.
However, some states say that these bikes cannot be ridden on roads and that should only be allowed on private property.
As with anything, make sure that you check the limitations and laws for your state when it comes to electric bikes and conversion kits.