Theodore Roosevelt played two main roles in the Spanish-American War. First, as a member of the government, he pushed for the US to be prepared for the war and for the US to get involved in the war in an aggressive manner. Second, once the war actually broke out, Roosevelt famously raised a volunteer regiment called the Rough Riders and served as the second-in-command of the unit.
In the time just before the Spanish-American War, Roosevelt was the Assistant Secretary of the Navy. Roosevelt believed strongly that a war with Spain would be a good thing for the US. He felt that war would be morally good for the country because it would make the country tougher. He felt that war would be good for the US in more material terms because if the US played its cards correctly, it could take territories around the world. This would allow the US to have naval bases from which it could project power. For these reasons, Roosevelt argued for war. He also worked hard to make sure the Navy would be ready if war broke out. Finally, he messaged Admiral Dewey, commanding US forces in Asia, and ordered him to take the Philippines if the US went to war with Spain. In these ways, Roosevelt helped prepare the US for war and he helped push the country towards involvement in the war.
Once the war began, Roosevelt wanted to play a more direct part in it. He badly wanted to test his own masculinity and valor by actually fighting in a war. In order to accomplish this, he obtained permission to form the Rough Riders. With them, he fought in Cuba, making his name as a military leader. Thus, Roosevelt directly participated by fighting in the war.