Can an object be automatically rotated?
Palkonimo has the basics of it right, but you can accomplish the same thing more quickly using Blender's built in snap options.


Begin by picking two points on your model that you want to line up with an axis. Move the 3D cursor to one of those points.
Duplicate that point, and move it away along the axis you wish to align to.
Select the other of your chosen points on the model as the active element, expand your selection of the model using L or Ctrl +. 
Rotate, using vertex snap to active element, and target the vertex you duplicated earlier.