Offering Prayer inside the Ka`bah is a sunnah act of the Prophet (peace and blessings be upon him). It is recommended to do so if possible in our present time. However, if one is unable to do it, the Hajj is valid and there is nothing wrong with one.
The late Sheikh `Abdul-`Aziz Ibn Baz, former Mufti of Saudi Arabia, stated that: It is recommended to perform Prayer inside the Ka`bah if one is able to do it without inflicting hardship on himself or others. It is reported that the Prophet (peace and blessings be upon him) did so and said, “I fear that I have placed difficulty on my Ummah.” When `A’ishah asked him about offering Prayer inside the Ka`bah, he said, “Pray in Al-Hijr, for it is a part of it.”
These texts indicate that such an act is a rewardable deed. However, a Muslim should not harm others in order to get in there.
Upon entering the Ka`bah, a Muslim is recommended to pray two rak`ahs and say “Allahu Akbar” and make as much du`a’ (supplication) as he can, for by doing so he is following the guidance of the Prophet (peace and blessings be upon him).