Hi
The structure of the ports on a microcontroller varies slightly, checking the datasheet for the device you select will show the port input / output structures.
As for selecting a suitable microcontroller, you need to answer the following:
How many inputs and output do you need?
Do you need any hardware peripherals - serial ports, PWM signal generation, analogue - digital converters, timers, USB etc.
How fast does it need to run?
Do you want to use an internal oscillator or external crystal?
Development tools / language / ease of programming?
Probably any manufacturer of microcontrollers is likely to have a device that will fit your requirements, so this is mainly a matter of personal choice. I'd recommend a PIC microcontroller (
http://www.microchip.com) but you could look at Atmel devices or Picaxe (
http://www.rev-ed.co.uk/picaxe) - I've not used these, but they are said to be very easy to use, so might suit your requirements well.
You can program the Picaxe chips directly from a PC, but most microcontrollers will need a suitable programmer or ideally a debugger.
Most microcontrollers run at 5V or lower, so you will need a regulated 5V supply - this can be supplied from the 24V supply using a voltage regulator. Any inputs will also need to be reduced to 5V, either using 2 resistors as a voltage divider, or a resistor and a 5.1V zener diode. Outputs would indeed need to drive a transistor, both to provide the current required and to allow the relays to run from 24V but be controlled from the 5V microcontroller outputs.
I'd have a look around the microchip.com and Picaxe website, and search the web for more info before deciding which way to go. Its also worth considering if a microcontroller is really needed, or if logic gates would do the job - you don't say what this is for.
Ask if you need more info.