The vast majority of ultras are run on trails of some sort. Some are run on roads. Distance races tend to be more trail-oriented, while timed races tend to be more road-oriented (which may include things like running tracks or concrete sidewalks through parks).
Is one better than the other?
Not necessarily, though there are significant differences. Road running requires a lot of repetitive motions. Your running gait remains more or less the same for the duration of the event. Furthermore, road races tend to be rather flat. This puts stress on specific sets of muscles, tendons, ligaments, and bones. People that train primarily on trails usually have difficulty running on roads (like me).
Most trail runs require the runner to avoid obstacles such as roots, rocks, logs (both wooden and the kind left by animals... or lazy humans), and water or mud. Trail races tend to have more elevation change, so you spend more time traversing hills. This requires much more dynamic movement, which distributes the workload to different muscles, tendons, ligaments, and bones. People that train primarily on roads usually have difficulty running on trails.
My suggestion: Like I discussed in a previous section, it's best to choose a race with similar terrain and elevation as your training routes. If you live in a city surrounded by flat farmland, a mountain trail race would be a bad idea. It's the same deal if you like to train on trails with lots of elevation change. A road race will be more difficult than a trail race.
It is possible to take a “jack of all trades” approach and train on both roads and trails, which gives you MUCH more versatility. This would be the ideal situation if you have enough time to train before your first ultra.