Converting grayscale images to RGB carries 2 meanings:
1. The direct conversion that is only possible in the sense that the resulting file will still contain gray shades, but they will be stored in RGB pixels
2. The manual user-assisted conversion where an artist takes every part or pixel of the gray image and adds color to it.
The second meaning is not really a programming question because you need a human user (or human-level artificial intelligence) to do it.
The first meaning is very easy using different tools, such as Microsoft image objects (load gray, save RGB) or common imaging toolkits like leadtools (ColorResolutionCommand class).
You can find a code sample here:
Color resolution command