Have Police and Military ever Joined Protesters?
Yes, in many cases police and military do what they feel that is right. One example is in Germany with the Occupy movement in 2012. German police were once blocking the protesters. But later took of their helmets and their badges and joined the protesters and marched with them peacefully.
Another case is in Thailand in 2013 when the people were protesting against Thaksin who was seen as a very corrupt leader. When the police were sent to protect the Bangkok Metropolitan Police Bureau they put down their arms and joined the protesters. This created a potential shift in power. The police were able join protests without getting arrested because the countries they are in is democracy.
Have They ever used Weapons Against Their own Force?
Throughout the 21st century, this has not happened. But during the French Revolution, soldiers of France went against their own King and his soldiers. In the US there are also laws that only allow the police uniform to be used against criminals and not others. There are such restrictions of what police can do with with the uniform and what one can do “under the color of law.” This means they cannot by law use their weapons against other policemen.
Have governments ever arrested their police or military for joining protests?
Most Democratic countries will only arrest their police if they broke the law while protesting. For example, if they were rioting or injuring others. This happened in Gujarat, India in 2002, when police joined in religious riots. In this case, the police were later arrested for failing their duties like refusing to control violence and joining the crowds in killing minorities. In other countries that are dictatorships like Syria and North Korea the government often arrest their own forces as there are no laws to protect the police and military. This means that in democratic countries this happens rarely but in communist countries, this happens more often.
This concludes police and military are allowed to protest to some extent. Such as only protesting but not show violence in any way. There are many examples of this happening throughout the world. How they are treated depends on the type of government they are under, their actions (violent or not) and the reason for protesting.