Rebuilding indexes is a process that does not take the database offline. It does cause locks to the indexes while they are being rebuilt. This will lead to blocking of access to the index during that process. If you're using Enterprise level of SQL Server, you can do an ONLINE index rebuild which radically reduces that blocking process. This will not cause any kind of failover to a second server in a cluster, always on availability group, or mirror.